Since we deployed the new report updater the fulltext API usage has increased from 8M to 150M I don't think this is true, this means that we perform more fulltext requests than prefix+opensearch.
Description
Related Objects
Event Timeline
Everything is counted correctly by this script which uses the patched search request definition. Unfortunately we were used the pre-patch version until 2017-01-01 that undercounted API calls because it was not counting the 100M+ generator calls. I'm sorry that I didn't switch to using the latest refinery JARs sooner.
As for the sudden jump between Feb 3rd and Feb 5th, there's not much we can do to explain "why" suddenly we're getting 50-90 million more generator-based full-text search API calls on a daily basis than we did before.
Hive query for data:
ADD JAR hdfs:///wmf/refinery/current/artifacts/refinery-hive.jar; CREATE TEMPORARY FUNCTION search_classify AS 'org.wikimedia.analytics.refinery.hive.SearchClassifierUDF'; SELECT TO_DATE(ts) AS `date`, search_classify(uri_path, uri_query) AS api, IF(PARSE_URL(CONCAT('http://', uri_host, uri_path, uri_query), 'QUERY', 'generator') IS NOT NULL, 'TRUE', 'FALSE') AS `uses generator`, IF(PARSE_URL(CONCAT('http://', uri_host, uri_path, uri_query), 'QUERY', 'list') IS NOT NULL, 'TRUE', 'FALSE') AS `uses list`, COUNT(1) AS requests FROM wmf.webrequest WHERE webrequest_source = 'text' AND ( year = 2016 OR (year = 2017 AND month = 1 AND day = 1) OR (year = 2017 AND month = 1 AND day = 22) OR (year = 2017 AND month = 2 AND day = 3) OR (year = 2017 AND month = 2 AND day = 5) OR (year = 2017 AND month = 2 AND day = 19) ) AND NOT is_pageview AND http_status = '200' AND ts IS NOT NULL AND search_classify(uri_path, uri_query) IN('language', 'cirrus', 'prefix', 'geo', 'open') GROUP BY TO_DATE(ts), search_classify(uri_path, uri_query), IF(PARSE_URL(CONCAT('http://', uri_host, uri_path, uri_query), 'QUERY', 'generator') IS NOT NULL, 'TRUE', 'FALSE'), IF(PARSE_URL(CONCAT('http://', uri_host, uri_path, uri_query), 'QUERY', 'list') IS NOT NULL, 'TRUE', 'FALSE');
R code for plot:
library(tidyverse) api_usage <- read_csv("~/Downloads/query-hive-408.csv") api_usage %>% dplyr::filter(api != "language") %>% mutate(date = format(date, "%m/%d"), call = case_when( .$`uses generator` & !.$`uses list` ~ "that just use generator", .$`uses generator` & .$`uses list` ~ "that use both", !.$`uses generator` & .$`uses list` ~ "that just use list", !.$`uses generator` & !.$`uses list` ~ "that use neither" )) %>% group_by(date, api, call) %>% summarize(requests = sum(requests)) %>% ggplot(aes(x = factor(date), y = requests, color = call)) + geom_linerange(aes(ymin = 0, ymax = requests), position = position_dodge(width = 1)) + geom_text(aes(label = polloi::compress(requests, 1), vjust = "bottom"), position = position_dodge(width = 1)) + facet_wrap(~ api, nrow = 1, scales = "free_y") + scale_color_brewer(palette = "Set1") + labs(x = "Date", y = "Requests", color = "API calls", title = "Search API usage on certain days in January and February", subtitle = "Using the patched UDF (https://gerrit.wikimedia.org/r/#/c/315503/)") + theme_minimal(base_family = "Open Sans", base_size = 12) + theme(legend.position = "bottom", axis.text.y = element_blank(), axis.ticks.y = element_blank(), axis.line.y = element_blank(), panel.grid.major.y = element_blank(), panel.grid.minor.y = element_blank(), strip.background = element_rect(fill = "gray10"), strip.text = element_text(color = "white", size = 12))
@mpopov thanks for the investigation!
I remember this patch and I'm really surprised that it had such impact...
I'll continue to investigate on my side because I cannot reconcile these numbers with the dashboard we use for server monitoring (grafana).
Would you mind keeping this task open for a little while?
Thanks!
Moving to stalled - we're waiting for some free time to come to @dcausse to investigate further. :)
I wonder if the differences we have between this dashboard and our server monitor can be caused by morelike api queries being cached by varnish.
I'll try to run your same queries extracting cache_status to see if it's closer to the numbers I have in grafana.
Certainly related to T154681 (patch deployed Feb 3: https://gerrit.wikimedia.org/r/#/c/335686/)
I think we can say thanks to varnish! :)

