Best way to handle concurrency issues

后端 未结 11 1192
迷失自我
迷失自我 2021-02-07 23:27

i have a LAPP (linux, apache, postgresql and php) environment, but the question is pretty the same both on Postgres or Mysql.

I have an cms app i developed, that handle

11条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 23:40

    Your approach of querying the database is the best one. If you do it every 5 seconds and you have 15 concurrent users then you're looking at ~3 queries a second. It should be a very small query too, returning only one row of data. If your database can't handle 3 transactions a second then you might have to look at a better database because 3 queries/second is nothing.

    Timestamp the records in the table so you can quickly see if anything has changed without having to diff each field.

提交回复
热议问题