Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production tuning #17

Merged
merged 7 commits into from
Dec 12, 2024
Merged

Production tuning #17

merged 7 commits into from
Dec 12, 2024

Conversation

DamianZaremba
Copy link
Member

  • Fix recent edits to look back 2 weeks, rather than from the time the edit was received
  • Remove cluster node logic, use single endpoint for core/relay
  • Add MySQL statement limits on replica queries
  • Fix SQL syntax in user distinct pages query

This will impact the scoring due to the user distinct pages & recent edit logic changes.

It will also prefer dropping edits, rather than hogging connections, which should improve overall throughput at the cost of large users.

Production setup is all contained within 1 pod, so everything is on
localhost (same network namespace).
Some of these queries can take 2min+, during which time the connection
is consumed.

Fail quickly to allow more overall throughput, at the cost of a loss of
correctness in the edge cases (edits will be skipped).

Note: The queries are usually slow on accounts with lots of edits e.g.
bots, which likely are not going to be reverted anyway.

Sample timings (from botng, which uses the same queries):
name					P95(duration_ms)	AVG(duration_ms)
loader.LoadDistinctPagesCount		18,179.03402		3,005.03574
loader.LoadUserWarnsCount		572.02909		127.03932
loader.LoadPageRecentRevertCount	253.82347		66.91965
loader.LoadPageRevision			163.07911		106.22102
loader.LoadPageMetadata			104.4249		179.18445
loader.LoadUserEditCount		84.84196		11.34932
loader.LoadPageRecentEditCount		9.95227			6.23804

Example edits (also from botng, but shows the challenge)
UUID					duration_ms	Related username
6f9b2f64-bced-4a2f-af1e-5f02bc3b4218	174,505.79937	InternetArchiveBot
94141464-459e-48cf-9901-9a9161fae17c	168,008.14787	AnomieBOT
05e3e528-3f36-493f-91d6-fb7e9aaaaa93	47,951.95634	EmausBot
89f2ef9c-1ec3-425e-b667-a92476a358cf	13,345.4171	Plantdrew
68733457-aafe-426f-b91c-cd85e4c733a6	5,618.97978	Dimadick
@DamianZaremba
Copy link
Member Author

DamianZaremba commented Dec 12, 2024

Query limits are working

PHP Fatal error:  Uncaught mysqli_sql_exception: Query execution was interrupted (max_statement_time exceeded) in /data/project/cluebotng/apps/bot/mysql_functions.php:232
Stack trace:
#0 /data/project/cluebotng/apps/bot/mysql_functions.php(232): mysqli_query()
#1 /data/project/cluebotng/apps/bot/cbng.php(192): CluebotNG\getCbData()
#2 /data/project/cluebotng/apps/bot/process_functions.php(57): CluebotNG\parseFeedData()
#3 /data/project/cluebotng/apps/bot/feed_functions.php(111): CluebotNG\Process::processEdit()
#4 /data/project/cluebotng/apps/bot/feed_functions.php(44): CluebotNG\Feed::loop()
#5 /data/project/cluebotng/apps/bot/cluebot-ng.php(45): CluebotNG\Feed::connectLoop()
#6 {main}
  thrown in /data/project/cluebotng/apps/bot/mysql_functions.php on line 232
Got SIGCHLD ...
PID 940 exited with status 255
PHP Fatal error:  Uncaught mysqli_sql_exception: Query execution was interrupted (max_statement_time exceeded) in /data/project/cluebotng/apps/bot/mysql_functions.php:232
Stack trace:
#0 /data/project/cluebotng/apps/bot/mysql_functions.php(232): mysqli_query()
#1 /data/project/cluebotng/apps/bot/cbng.php(192): CluebotNG\getCbData()
#2 /data/project/cluebotng/apps/bot/process_functions.php(57): CluebotNG\parseFeedData()
#3 /data/project/cluebotng/apps/bot/feed_functions.php(111): CluebotNG\Process::processEdit()
#4 /data/project/cluebotng/apps/bot/feed_functions.php(44): CluebotNG\Feed::loop()
#5 /data/project/cluebotng/apps/bot/cluebot-ng.php(45): CluebotNG\Feed::connectLoop()
#6 {main}
  thrown in /data/project/cluebotng/apps/bot/mysql_functions.php on line 232
Got SIGCHLD ...
PID 946 exited with status 255
Got SIGCHLD ...
PID 966 exited with status 0

Sample timings (from botng, which uses the same queries) - user distinct pages count on top:
Screenshot 2024-12-12 at 14 34 52

@DamianZaremba DamianZaremba merged commit a0db747 into main Dec 12, 2024
1 check passed
@DamianZaremba DamianZaremba deleted the feature/more-work branch December 12, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant