How to update on a mysql myisam table becomes inconsistent with high concurrency?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sweep erp
    New Member
    • Nov 2010
    • 1

    How to update on a mysql myisam table becomes inconsistent with high concurrency?

    Hi, I have a simple php script that queries a mysql database returns the content and updates a counter. This works fine until a concurrent limit of around 25 (simulated using ab) is reached at which point the update value becomes inconsistent e.g simulating 25 concurrent users hitting the script 500 times should set the counter to 500 but sometimes it is 498 or 499. I know the simulation isn't real life (thinking time etc) but 25 seems quite low. Would switching to innodb or using transactions solve the issue? My query is simply a select then an update. Thx
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #2
    yes it could be one of the possible options as ROW LEVEL AND TABLE LEVEL LOCKING DO MAKE A DIFF IN YOUR CASE NOT SURE BUT YOU MUST GO FOR IT
    regards
    Omer Aslam

    Comment

    Working...