glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

Log when the latency of a fop is more than some time

Open raghavendrabhat opened this issue 8 years ago • 9 comments

The profile info helps in getting a good view about the latency seen by the bricks for different fops (such as avg latency, minimum latency, max latency, no of calls etc).

Usually when someone complains about high latency, profile info is collected to understand the latency seen in the bricks for different fops. The maximum latency gives a picture about what was the highest latency seen for a particular fop. Lets say that the max latency for a fop is 5 seconds. It tells us that once 5 seconds latency was seen. But the overall latency could be contributed by the other instances of that fop which took 4 seconds, 3 seconds, which is difficult to get as of now.

So, whenever profiling is enabled for the volume, then it would be better if io-stats xlator logs every instance of a fop which sees a latency higher than a preconfigured (and configurable) value.

Ex: Lets say that io-stats logs every time a fop takes more than 2 seconds to complete. It helps get an understanding of how many such high latency were seen. ALso was there any specific time period when this issue was seen. Helps in debugging.

raghavendrabhat avatar Apr 09 '18 15:04 raghavendrabhat

If i can distill the problem statement a bit, I think you're saying that the current min/avg/max profile reporting is insufficient for debugging because we can't tell whether the distribution of latencies is clustered around the mean with very few outliers or whether there are significant numbers of outliers (in both directions).

My concern w/ the threshold approach is that it is very difficult to tune such that you get useful information w/o a ton of log spam.

Could we achieve the goal by improving the summary statistics? For example:

  • Adding higher order moments (e.g., variance, skewness, kurtosis)
  • Calculating approximate quantiles for the latencies (e.g., 10%-ile, 20%-ile, ..., 95%-ile, 99%-ile)

The above could then feed into alerting if desired... "Warn me when the 95th percentile latency is > 500 ms."

JohnStrunk avatar Apr 09 '18 16:04 JohnStrunk

Hmm. Good points John.

My current thought was to log any latency higher than a configured value (say 2 seconds). i.e. consider a latency higher than 1 second as a kind of sign of warning and any latency more than 2 seconds as something that has to be notified.

My current thoughts were aligned in these terms.

  1. Maintain a counter of number of calls for each fop that saw more than 1 second (but less than 2 seconds) latency.

Log that value as part of regular logging (this happens only when profiling is enabled on the volume)

Ex: 34 calls of "mkdir" took more than 1 second latency.

  1. Log every operation of any fop that takes more than 2 seconds latency.

I agree that this might lead to log spamming. But that also helps understand how frequently this happens. If its frequent enough, then probably something that should be looked into.

Here I am mainly focusing on the latency seen by the bricks. So, usually high latency can relate to underlying disk filesystem or layers below that (but yes, there is a chance that some layer in gluster brick itself might be causing the latency).

The above points were also with the intention that its relatively easier to implement the above changes.

But if the points you mentioned can help get the same information without causing logs to be flooded with such messages, then I think its worth exploring.

raghavendrabhat avatar Apr 09 '18 17:04 raghavendrabhat

Here's another idea that backs down the implementation complexity: fixed width histograms. We seem to already do that for I/O sizes, so we could for latencies also. For example, counts for 100us, 200us, 500us, 1ms, 2ms, ..., 1s, 2s, 5s+

JohnStrunk avatar Apr 09 '18 17:04 JohnStrunk

Good point. I think its better where, it will get more information with more granularity (such as fops with latencies of 100us, 200us etc) and also prevents flooding of the logs.

Especially the incremental profile info can be used with the above information you mentioned to get a better view of latency seen and how they are spread across different regions of latency in that duration.

And the cumulative profile will give the overall generic impression about how the fops performed till now.

raghavendrabhat avatar Apr 09 '18 17:04 raghavendrabhat

@raghavendrabhat hey, are you working on this change? Do you know if anyone else is working on this change? We need this information for metrics collection.

pranithk avatar Jul 26 '18 15:07 pranithk

@raghavendrabhat pinging again :-)

pranithk avatar Sep 03 '18 06:09 pranithk

I am not working on it actively. This was opened mainly to ensure that some of the gaps or improvements are recorded here and we can prioritize it when needed.

My initial plan was to just log those fops whose latency is more than 1 second. That would have been quicker. But after discussing it here with John Strunk, I think his approach might be better. I am not actively working on this as of now as I am focusing on other things.

raghavendrabhat avatar Nov 12 '18 13:11 raghavendrabhat

Thank you for your contributions. Noticed that this issue is not having any activity in last ~6 months! We are marking this issue as stale because it has not had recent activity. It will be closed in 2 weeks if no one responds with a comment here.

stale[bot] avatar Apr 30 '20 06:04 stale[bot]

Closing this issue as there was no update since my last update on issue. If this is an issue which is still valid, feel free to open it.

stale[bot] avatar May 15 '20 06:05 stale[bot]