Skip to content

Concurency problem with click count function #2829

@vipwangtian

Description

@vipwangtian

There's a problem while a large number of people click the same short url at the same time.
Last week our establishment push an activity online which use yourls as an entry point, I noticed that the qps is only 30 and a lot of 504 response on nginx log. So I did a performance test on different environments, but the QPS always about 30. Then I query the mysql lock state and find that there are so many locks on yourls_url table executing UPDATE yourls_urlSETclicks= clicks + 1 WHEREkeyword = '3vz7wj' statement. After that, I removed yourls_update_clicks function in functions.php file and did the test again. QPS had a surprising advance more than 400.
Is there a solution to solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions