Closed prog-supdex closed 1 year ago
I ran a benchmark for whole statistics (with mode include_subscriptions: true
)
with these numbers
{"total":{"subscription":49000,"fingerprints":7002,"subscriptions":49002,"channel":49000}
the module Stats
had the next results
user system total real
only total amount 2.239396 0.087184 2.326580 ( 2.945300)
total amount with grouped subscriptions 8.423945 1.860734 10.284679 ( 12.442578)
Here we see that full Stats
took 12 seconds. Only total numbers (without grouping by subscriptions) took 3 seconds
Also, I changed the count
argument for group_subscription_stats
because the 1000 count
showed a better result (but it was not a significant difference)
user system total real
COUNT 10 only grouped 6.492952 1.814657 8.307609 ( 9.801935)
COUNT 100 only grouped 5.703477 1.721931 7.425408 ( 8.784324)
COUNT 1000 only grouped 5.324353 1.691193 7.015546 ( 8.279561)
COUNT 10000 only grouped 5.684741 1.895940 7.580681 ( 8.973217)
This PR adds an ability to call
GraphQL::AnyCable.stats
, which will return the subscription statistics.For calculating specific existing keys in the
Redis
store, we are usingscan_each
with the argumentcount
The default
count
value inscan_each
is 10. But this value is not suitable. So, I ran a benchmark and saw that value1000
would be more suitable for itThe Redis store, before the benchmark, was filled with 500_000 records
Also, if we use the default value
10
, it will make a lot of calls toRedis
For calculating subscribes by subscriptions, I decided to each by
100
elements in thegroup_subscription_stats
method