Page MenuHomePhabricator

Investigate high read requests on restbase1012-a
Closed, ResolvedPublic

Description

In the last days, 1012-b has seen a very high number of read requests. It would be good to look into the source of this imbalance. A good way to do so would be to take a sample of reads on 1012-b using nodetool toppartitions.

The source of those requests seems to be internal (production or labs), as traffic increased on both 1012-b and the general internal request metric at the same time:

pasted_file (1×1 px, 251 KB)

Event Timeline

GWicke triaged this task as High priority.

Other ideas:

  • bootstraps: SAL says that 2004 was started 24 hours later, so unlikely.
  • repairs

Top user agents in error messages over the last 10 days:

Term Count Action
Magnus labs tools 28227
MediaWiki/1.27.0-wmf.18 (RestbaseUpdateJob) 21209
Ruby 19052
wikimedia/multi-http-client v1.0 1421
pageviews.jsv1.0.7 (git+https://github.com/tomayac/pageviews.js.git) 1290
MediaWiki/1.27.0-wmf.19 (RestbaseUpdateJob) 674
http-kit/2.0 329
Mozilla/5.0 (compatible; Google-Apps-Script) 165
REST-API-Crawler-Google/1.0 (+wikidata-external@google.com) 132
Missing field 1736109
Other values 1188

The top ones do not seem to align with the increase in internal requests & 1012-b traffic.

Interestingly, read request completed looks fairly even between nodes & instances:

pasted_file (1×1 px, 737 KB)

Actually, https://grafana-admin.wikimedia.org/dashboard/db/restbase-cassandra-client-requests?panelId=32&fullscreen&from=1459248919680&to=1459313279864&var-datacenter=1&var-node=All&var-quantile=99percentile&edit is showing a *latency* rate, and not requests per second:

cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency.1MinuteRate

I'm inclined to close this task as invalid. @fgiunchedi @Eevans: Any objections?

Actually, https://grafana-admin.wikimedia.org/dashboard/db/restbase-cassandra-client-requests?panelId=32&fullscreen&from=1459248919680&to=1459313279864&var-datacenter=1&var-node=All&var-quantile=99percentile&edit is showing a *latency* rate, and not requests per second:

cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency.1MinuteRate

I'm inclined to close this task as invalid. @fgiunchedi @Eevans: Any objections?

I'm not sure this is right. cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency is a dropwizard timer (see: https://dropwizard.github.io/metrics/3.1.0/getting-started/#timers), which "...measures both the rate that a particular piece of code is called and the distribution of its duration".

Actually, https://grafana-admin.wikimedia.org/dashboard/db/restbase-cassandra-client-requests?panelId=32&fullscreen&from=1459248919680&to=1459313279864&var-datacenter=1&var-node=All&var-quantile=99percentile&edit is showing a *latency* rate, and not requests per second:

cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency.1MinuteRate

I'm inclined to close this task as invalid. @fgiunchedi @Eevans: Any objections?

I'm not sure this is right. cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency is a dropwizard timer (see: https://dropwizard.github.io/metrics/3.1.0/getting-started/#timers), which "...measures both the rate that a particular piece of code is called and the distribution of its duration".

Also, it seems like too much of a coincidence that the jump in rate so closely matches the jump in internal request rate:

pasted_file (1×1 px, 251 KB)

screenshot-grafana-admin wikimedia org 2016-03-31 15-05-25.png (281×1 px, 75 KB)

I'm not sure this is right. cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency is a dropwizard timer (see: https://dropwizard.github.io/metrics/3.1.0/getting-started/#timers), which "...measures both the rate that a particular piece of code is called and the distribution of its duration".

Which means that requests / second is only one ingredient to the sum, with latency being the other, and labeling this as a request rate with unit req/s is misleading.

The client metrics for 1012-b don't seem to agree with thread stats on rates or latency. Thread metrics have so far proven accurate, and they do agree with secondary metrics like gc times in the concrete case. I'm inclined to continue using them as the primary request rate / latency metrics.

I'm not sure this is right. cassandra.$node.org.apache.cassandra.metrics.ClientRequest.Read.Latency is a dropwizard timer (see: https://dropwizard.github.io/metrics/3.1.0/getting-started/#timers), which "...measures both the rate that a particular piece of code is called and the distribution of its duration".

Which means that requests / second is only one ingredient to the sum, with latency being the other, and labeling this as a request rate with unit req/s is misleading.

I don't follow. The timer that records how long a request method takes (latency) is able to provide the rate at which that method is called, for free. The name might be misleading, but the rate produced is valid. In this case, the method that is being timed is o.a.c.service.StorageProxy#read, which corresponds to every read request a node receives from a client (including those that are coordinated). That sounds exactly right for a graph of client requests.

The client metrics for 1012-b don't seem to agree with thread stats on rates or latency. Thread metrics have so far proven accurate, and they do agree with secondary metrics like gc times in the concrete case. I'm inclined to continue using them as the primary request rate / latency metrics.

We see a jump in restbase requests to, ~1.5k/s, starting at ~14:00 on the 29th, and a corresponding jump in client requests (~1.5k/s) on 1012-b at the same time. That doesn't strike you as a useful and interesting correlation?

This is interesting:

1$ cdsh -c restbase -d eqiad -- c-commands/c-foreach-nt toppartitions -a READS -k 5 local_group_wikipedia_T_parsoid_html data 10000restbase1007.eqiad.wmnet: a: READS Sampler:
2restbase1007.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
3restbase1007.eqiad.wmnet: a: Top 5 partitions:
4restbase1007.eqiad.wmnet: a: Partition Count +/-
5restbase1007.eqiad.wmnet: a: it.wikipedia.org:Road_Italy 6 0
6restbase1007.eqiad.wmnet: a: it.wikipedia.org:Francesco_Chiusuri 5 0
7restbase1007.eqiad.wmnet: a: it.wikipedia.org:Arenthon 5 0
8restbase1007.eqiad.wmnet: a: uk.wikipedia.org:Генрі_Філдінг 5 0
9restbase1007.eqiad.wmnet: a: en.wikipedia.org:Predrag_Drobnjak 5 0
10restbase1007.eqiad.wmnet: b: READS Sampler:
11restbase1007.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
12restbase1007.eqiad.wmnet: b: Top 5 partitions:
13restbase1007.eqiad.wmnet: b: Partition Count +/-
14restbase1007.eqiad.wmnet: b: it.wikipedia.org:Proconsul 6 0
15restbase1007.eqiad.wmnet: b: en.wikipedia.org:Islamic_State_of_Iraq_and_the_Levant 5 0
16restbase1007.eqiad.wmnet: b: en.wikipedia.org:The_Single_Guy 5 0
17restbase1007.eqiad.wmnet: b: sv.wikipedia.org:7,5_cm_KwK_40 5 0
18restbase1007.eqiad.wmnet: b: it.wikipedia.org:Assedio_di_Stralsund_(1807) 5 0
19restbase1010.eqiad.wmnet: a: READS Sampler:
20restbase1010.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
21restbase1010.eqiad.wmnet: a: Top 5 partitions:
22restbase1010.eqiad.wmnet: a: Partition Count +/-
23restbase1010.eqiad.wmnet: a: ja.wikipedia.org:毛利小五郎 7 0
24restbase1010.eqiad.wmnet: a: be.wikipedia.org:Дзмітрый_Мікалаевіч_Шчагрыковіч 6 0
25restbase1010.eqiad.wmnet: a: sv.wikipedia.org:Mercedes-Benz_W211 5 0
26restbase1010.eqiad.wmnet: a: ru.wikipedia.org:Дзигони,_Джанмарко 5 0
27restbase1010.eqiad.wmnet: a: sv.wikipedia.org:E401 5 0
28restbase1010.eqiad.wmnet: b: READS Sampler:
29restbase1010.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
30restbase1010.eqiad.wmnet: b: Top 5 partitions:
31restbase1010.eqiad.wmnet: b: Partition Count +/-
32restbase1010.eqiad.wmnet: b: en.wikipedia.org:CIS_Corps_(Ireland) 3434 0
33restbase1010.eqiad.wmnet: b: en.wikipedia.org:Communications_and_Information_Services_Corps 1542 0
34restbase1010.eqiad.wmnet: b: ru.wikipedia.org:Малахов,_Николай_Николаевич 5 0
35restbase1010.eqiad.wmnet: b: sv.wikipedia.org:Ivar_Los_park 5 0
36restbase1010.eqiad.wmnet: b: en.wikipedia.org:Santa_(telenovela) 5 0
37restbase1011.eqiad.wmnet: a: READS Sampler:
38restbase1011.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
39restbase1011.eqiad.wmnet: a: Top 5 partitions:
40restbase1011.eqiad.wmnet: a: Partition Count +/-
41restbase1011.eqiad.wmnet: a: hi.wikipedia.org:विद्युत_अवयव 601 0
42restbase1011.eqiad.wmnet: a: fr.wikipedia.org:Montottone 5 0
43restbase1011.eqiad.wmnet: a: sv.wikipedia.org:Portal:Sjöfart/Sjöfartsartikeln/Arkiv 5 0
44restbase1011.eqiad.wmnet: a: fr.wikipedia.org:Paul_Lasaosa 5 0
45restbase1011.eqiad.wmnet: a: en.wikipedia.org:List_of_Pittsburgh_Steelers_starting_quarterbacks 5 0
46restbase1011.eqiad.wmnet: b: READS Sampler:
47restbase1011.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
48restbase1011.eqiad.wmnet: b: Top 5 partitions:
49restbase1011.eqiad.wmnet: b: Partition Count +/-
50restbase1011.eqiad.wmnet: b: ru.wikipedia.org:Янев,_Евгений 525 0
51restbase1011.eqiad.wmnet: b: ar.wikipedia.org:مقاطعة_شامبين_(إلينوي) 7 0
52restbase1011.eqiad.wmnet: b: sv.wikipedia.org:Erik_Jørgensen 5 0
53restbase1011.eqiad.wmnet: b: it.wikipedia.org:Tramonto_(film_1924) 5 0
54restbase1011.eqiad.wmnet: b: uk.wikipedia.org:Гумільов_Микола_Степанович 5 0
55restbase1008.eqiad.wmnet: a: READS Sampler:
56restbase1008.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
57restbase1008.eqiad.wmnet: a: Top 5 partitions:
58restbase1008.eqiad.wmnet: a: Partition Count +/-
59restbase1008.eqiad.wmnet: a: pl.wikipedia.org:Harry_King_Goode 7 0
60restbase1008.eqiad.wmnet: a: de.wikipedia.org:Ronja_von_Rönne 6 0
61restbase1008.eqiad.wmnet: a: ru.wikipedia.org:Хамидов,_Сухроб_Садуллаевич 5 0
62restbase1008.eqiad.wmnet: a: sv.wikipedia.org:Hud_(sura) 5 0
63restbase1008.eqiad.wmnet: a: ba.wikipedia.org:Иглин 5 0
64restbase1008.eqiad.wmnet: b: READS Sampler:
65restbase1008.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
66restbase1008.eqiad.wmnet: b: Top 5 partitions:
67restbase1008.eqiad.wmnet: b: Partition Count +/-
68restbase1008.eqiad.wmnet: b: ru.wikipedia.org:Янев,_Евгений 373 0
69restbase1008.eqiad.wmnet: b: it.wikipedia.org:Teatro_Nuovo_(Firenze,_via_Bufalini) 5 0
70restbase1008.eqiad.wmnet: b: uk.wikipedia.org:Пшеничний_Микола_Іванович 5 0
71restbase1008.eqiad.wmnet: b: ba.wikipedia.org:Ҡалдар 5 0
72restbase1008.eqiad.wmnet: b: ru.wikipedia.org:GNU_Multi-Precision_Library 5 0
73restbase1012.eqiad.wmnet: a: READS Sampler:
74restbase1012.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
75restbase1012.eqiad.wmnet: a: Top 5 partitions:
76restbase1012.eqiad.wmnet: a: Partition Count +/-
77restbase1012.eqiad.wmnet: a: en.wikipedia.org:Communications_and_Information_Services_Corps 2831 0
78restbase1012.eqiad.wmnet: a: ru.wikipedia.org:Паранойя_(фильм,_2013) 7 0
79restbase1012.eqiad.wmnet: a: en.wikipedia.org:James_Calvin_Wilsey 5 0
80restbase1012.eqiad.wmnet: a: sv.wikipedia.org:Al-Muddathir 5 0
81restbase1012.eqiad.wmnet: a: sv.wikipedia.org:Al-Burudj 5 0
82restbase1012.eqiad.wmnet: b: READS Sampler:
83restbase1012.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
84restbase1012.eqiad.wmnet: b: Top 5 partitions:
85restbase1012.eqiad.wmnet: b: Partition Count +/-
86restbase1012.eqiad.wmnet: b: en.wikipedia.org:CIS_Corps_(Ireland) 3339 0
87restbase1012.eqiad.wmnet: b: sh.wikipedia.org:Minella,_Padova 6 0
88restbase1012.eqiad.wmnet: b: sv.wikipedia.org:Atle_(isbrytare,_1925) 5 0
89restbase1012.eqiad.wmnet: b: fr.wikipedia.org:Takuya_Marutani 5 0
90restbase1012.eqiad.wmnet: b: sv.wikipedia.org:Chrysler_Airflow 5 0
91restbase1013.eqiad.wmnet: a: READS Sampler:
92restbase1013.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
93restbase1013.eqiad.wmnet: a: Top 5 partitions:
94restbase1013.eqiad.wmnet: a: Partition Count +/-
95restbase1013.eqiad.wmnet: a: ar.wikipedia.org:محمد_المقراني 9 0
96restbase1013.eqiad.wmnet: a: sv.wikipedia.org:Schweiz_ambassad_i_Stockholm 6 0
97restbase1013.eqiad.wmnet: a: zh.wikipedia.org:User:52Dora/MainPage 5 0
98restbase1013.eqiad.wmnet: a: sv.wikipedia.org:Maserati_A6GCM 5 0
99restbase1013.eqiad.wmnet: a: fr.wikipedia.org:Thierry_Loder 5 0
100restbase1013.eqiad.wmnet: b: READS Sampler:
101restbase1013.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
102restbase1013.eqiad.wmnet: b: Top 5 partitions:
103restbase1013.eqiad.wmnet: b: Partition Count +/-
104restbase1013.eqiad.wmnet: b: hi.wikipedia.org:विद्युत_अवयव 548 0
105restbase1013.eqiad.wmnet: b: ar.wikipedia.org:محمد_بن_موسى_الخوارزمي 7 0
106restbase1013.eqiad.wmnet: b: sv.wikipedia.org:Island_och_Europeiska_unionen 6 0
107restbase1013.eqiad.wmnet: b: ar.wikipedia.org:خير_الدين_بربروس 6 0
108restbase1013.eqiad.wmnet: b: zh.wikipedia.org:User:长夜无风/首页 5 0
109restbase1005.eqiad.wmnet: READS Sampler:
110restbase1005.eqiad.wmnet: Cardinality: ~2 (256 capacity)
111restbase1005.eqiad.wmnet: Top 5 partitions:
112restbase1005.eqiad.wmnet: Partition Count +/-
113restbase1005.eqiad.wmnet: en.wikipedia.org:CIS_Corps_(Ireland) 342 0
114restbase1005.eqiad.wmnet: en.wikipedia.org:John_C._Butler-class_destroyer_escort 10 0
115restbase1005.eqiad.wmnet: nn.wikipedia.org:Pendéli_i_Aten 9 0
116restbase1005.eqiad.wmnet: ar.wikipedia.org:جهيمان_العتيبي 7 0
117restbase1005.eqiad.wmnet: ar.wikipedia.org:مقاطعة_ماديسون_(إلينوي) 7 0
118restbase1006.eqiad.wmnet: READS Sampler:
119restbase1006.eqiad.wmnet: Cardinality: ~2 (256 capacity)
120restbase1006.eqiad.wmnet: Top 5 partitions:
121restbase1006.eqiad.wmnet: Partition Count +/-
122restbase1006.eqiad.wmnet: en.wikipedia.org:Communications_and_Information_Services_Corps 3401 0
123restbase1006.eqiad.wmnet: th.wikipedia.org:หน่วยปฏิบัติการสายลับชีลด์ 7 0
124restbase1006.eqiad.wmnet: zh.wikipedia.org:User\:Gnaggnoyil/MainPage 6 0
125restbase1006.eqiad.wmnet: ru.wikipedia.org:Ровинский,_Феликс_Яковлевич 5 0
126restbase1006.eqiad.wmnet: sv.wikipedia.org:Aquarius_(laboratorium) 5 0
127restbase1009.eqiad.wmnet: a: READS Sampler:
128restbase1009.eqiad.wmnet: a: Cardinality: ~2 (256 capacity)
129restbase1009.eqiad.wmnet: a: Top 5 partitions:
130restbase1009.eqiad.wmnet: a: Partition Count +/-
131restbase1009.eqiad.wmnet: a: it.wikipedia.org:82346_Hakos 5 0
132restbase1009.eqiad.wmnet: a: en.wikipedia.org:Spithead_and_Nore_mutinies 5 0
133restbase1009.eqiad.wmnet: a: sv.wikipedia.org:Fountains_Abbey 5 0
134restbase1009.eqiad.wmnet: a: sh.wikipedia.org:Romans_d'Isonzo,_Gorizia 5 0
135restbase1009.eqiad.wmnet: a: pl.wikipedia.org:Birendra_Bir_Bikram_Shah_Dev 5 0
136restbase1009.eqiad.wmnet: b: READS Sampler:
137restbase1009.eqiad.wmnet: b: Cardinality: ~2 (256 capacity)
138restbase1009.eqiad.wmnet: b: Top 5 partitions:
139restbase1009.eqiad.wmnet: b: Partition Count +/-
140restbase1009.eqiad.wmnet: b: hi.wikipedia.org:विद्युत_अवयव 600 0
141restbase1009.eqiad.wmnet: b: ru.wikipedia.org:Янев,_Евгений 225 0
142restbase1009.eqiad.wmnet: b: sv.wikipedia.org:Zadní_vrch 8 0
143restbase1009.eqiad.wmnet: b: en.wikipedia.org:Salon_XIII 8 0
144restbase1009.eqiad.wmnet: b: sv.wikipedia.org:Sautso 5 0
145

There seems to be a disproportionate amount of traffic directed at https://en.wikipedia.org/wiki/Communications_and_Information_Services_Corps (and CIS Corps (Ireland), which redirects https://en.wikipedia.org/wiki/Communications_and_Information_Services_Corps). It has been this way for the past 30 minutes or so (at least).

We see a jump in restbase requests to, ~1.5k/s, starting at ~14:00 on the 29th, and a corresponding jump in client requests (~1.5k/s) on 1012-b at the same time. That doesn't strike you as a useful and interesting correlation?

It is an interesting correlation, which is why I pointed it out originally.

I think we have established that the original metric does not indicate read rates or read latency processed on a particular node. We have reliable numbers for those, and they indicate a fairly even distribution of reads and latency. If anything, latency on 1012 is on the lower end of the scale on those metrics. This means that we are not dealing with a repeat request for a single key.

This leaves the question of whether those client metrics are reliable, and what they mean. Generally, client metrics are supposed to be requests to a node acting as a coordinator, which means that the actual reads / writes don't necessarily happen on the node itself. This would leave the option that this node would be picked more often than usual as a coordinator by the driver. If this was the case, then I would expect the instance to be more heavily loaded, which would manifest itself as higher GC and CPU load. So far, I have not seen any indications that this is indeed the case for 1012-b.

@Eevans, the toppartition results are consistent with https://grafana.wikimedia.org/dashboard/db/cassandra-restbase-eqiad?panelId=24&fullscreen.

To me, it looks like some internal tool has a bug in redirect handling.

We are preparing to deploy sampled request logging in production, which should give us an idea on which client is hitting those titles.

Okay, @Pchelolo resolved the mystery by deploying the sampled logging logic. The source of those requests is the mobile content service, and there was indeed a redirect loop involved. Purging one of the pages in RESTBase broke the redirect loop, and request levels are back to normal.

Bugs:

  • Mobile content service redirect loop regression: T131416
  • Missed RESTBase update from move. The general logic in the RESTBaseUpdateExtension looks correct, and running the no-cache request manually worked. This might just be a case of a dropped update request (blip in job queue, no retries). Moving to change propagation should help fix this by letting us retry reliably.

Okay, @Pchelolo resolved the mystery by deploying the sampled logging logic. The source of those requests is the mobile content service, and there was indeed a redirect loop involved. Purging one of the pages in RESTBase broke the redirect loop, and request levels are back to normal.

Bugs:

  • Mobile content service redirect loop regression: T131416
  • Missed RESTBase update from move. The general logic in the RESTBaseUpdateExtension looks correct, and running the no-cache request manually worked. This might just be a case of a dropped update request (blip in job queue, no retries). Moving to change propagation should help fix this by letting us retry reliably.

Great work guys!

Mystery solved; Closing issue.