You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/05/23 15:25:45 UTC
[couchdb] branch update-fsync-time-delta created (now d7bbe14d9)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch update-fsync-time-delta
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at d7bbe14d9 Improve fsync metrics time calculation
This branch includes the following new commits:
new d7bbe14d9 Improve fsync metrics time calculation
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Improve fsync metrics time calculation
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch update-fsync-time-delta
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit d7bbe14d94383e10500097214f6fc5359954a495
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Tue May 23 11:24:12 2023 -0400
Improve fsync metrics time calculation
Since we're using fractional milliseconds, might as well measure at the
nanosecond resolution.
```
rp(couch_stats:sample([fsync,time])).
[{min,19.572592},
{max,41.60692},
{arithmetic_mean,22.214490860169498},
{geometric_mean,22.134517662321407},
{harmonic_mean,22.068093005211708},
{median,22.147823},
{variance,4.5064974888058495},
{standard_deviation,2.1228512639386325},
{skewness,5.243648789818805},
{kurtosis,43.072222638582026},
{percentile,[{50,22.147823},
{75,23.18369},
{90,23.573497},
{95,23.780686},
{99,27.245643},
{999,41.60692}]},
{histogram,[{20.572592,24},
{21.572592,68},
{22.572592,51},
{23.572592,68},
{24.572592,19},
{25.572592,3},
{26.572592,0},
{27.572592,1},
{28.572592,0},
{29.572592,0},
{30.572592,0},
{31.572592,0},
{32.572592,0},
{33.572592,0},
{34.572592,0},
{35.572592,0},
{36.572592,0},
{37.572592,0},
{38.572592,0},
{39.572592,1},
{40.572592,0},
{41.572592,0},
{42.572592,1}]},
{n,236}]
ok
```
---
src/couch/src/couch_file.erl | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 51b0e69e0..c9d7f2a93 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -643,13 +643,14 @@ format_status(_Opt, [PDict, #file{} = File]) ->
[{data, [{"State", File}, {"InitialFilePath", FilePath}]}].
fsync(Fd) ->
- % Our metrics histograms are in milliseconds so stick to that pattern.
- % However we measure the time delta in microseconds so we get fractional
- % microseconds for cases when the disk drives are faster.
- T0 = erlang:monotonic_time(microsecond),
+ T0 = erlang:monotonic_time(),
Res = file:sync(Fd),
- DtUSec = erlang:monotonic_time(microsecond) - T0,
- couch_stats:update_histogram([fsync, time], DtUSec / 1000),
+ T1 = erlang:monotonic_time(),
+ % Since histograms can consume floating point values we can measure in
+ % nanoseconds, then turn it into floating point milliseconds
+ DtNSec = erlang:convert_time_unit(T1 - T0, native, nanosecond),
+ DtMSec = DtNSec / 1000000,
+ couch_stats:update_histogram([fsync, time], DtMSec),
couch_stats:increment_counter([fsync, count]),
Res.