joshp23 / YOURLS-Expiry

YOURLS plugin to define conditions under which links will expire - time and click limited links
GNU General Public License v3.0
35 stars 13 forks source link

mysql utilization with 10rps #31

Closed agboon closed 3 years ago

agboon commented 3 years ago

Hi @joshp23. We have an issue with high CPU utilization on MySQL instance with 10 rps Request example: /yourls-api.php?signature=xxx&action=shorturl&expiry=clock&url=https://url/test?agreement%3D123%26clientId%3Dqqq%26timestamp%3D2020123001%26secret%3Drwq%26grantType%3Dreferal%26city_id%3D1%26ctrk%3D14695631803%26yourls_nodecode%3D1&age=6&title=qqqq1&format=json&keyword=1tAfwFAFW-PYstha7ka1Be-I%3D

Changing column yourls_expiry.keyword type to BINARY and excluding this from SELECT allows to lower CPU utilization to 0.1m from 3-5m

before: image after: image

Pull request with fixes: https://github.com/joshp23/YOURLS-Expiry/pull/30 PR is in branch https://github.com/joshp23/YOURLS-Expiry/tree/1.7.9-compat because i didn`t found tags higher than 1.7.9 in yourls and i want to upgrade my yourls app to v1.7.9. Mb i should make PR to Master branch and you will update 1.7.9-compat after, please say if so. Thanks.

joshp23 commented 3 years ago

done