On Wednesday, August 11, 2021, 07:00:22 AM PDT, Christopher Schultz <ch...@christopherschultz.net> wrote:
W, On 8/9/21 12:04, W wrote:>> Hi,I have a web application. It is a java-jsp-tomcat-mysql. It is working, but sometimes, it is slow. For each data update statement, it is not slow: the next jsp page shows promptly. But the next page does not see updated data. I wait a coupe seconds, refresh the page, the updated date shows. Each connection is from tomcat.DataSource, so I believe each jsp page may use a different database connection. So, mysql inside is slow. Anything I can do?>> I checked server cpu and memory. Cpu is 20%, memory is lower than 50%.> Everything is running on one server machine, one tomcat, one mysql, runs on Ubuntu: 4.15.0-54-generic, Tomcat/9.0.16, mysql: 8.0.21.>> Any information would be appreciated. Thanks in advance. >This is certainly an application issue, so I have marked this thread >as>"off-topic". That doesn't mean we can't help. >Please confirm the following: >1. An initial request arrives on the server which executes a SQL DML>query, >which changes some data in your database. The transaction is>committed. The >response is sent to the client. The query is commited, otherwise I would not see updated data after I refresh the next page. >2. A second request arrives *after the completion of the first request*>and >queries the data which was changed in #1 above. The data retrieved>from the >database appears to have values which are "old" -- that is, the>value that was >expected before #1 above occurred. Yes. >Some questions: >* Are you sure that #2 happens fully after #1? How are you sure?Yes. Otherwise >the second page would not appear. >* Are you absolutely sure you are querying the *same* data from >the>database?Yes. >* Are you absolutely sure that there is no "step 1.5" where the data >are>changed *back* to their original values? How are you sure?Yes. >* What is the "transaction isolation level" of your database>connections? Do >you execute your query in #2 within a transaction?I did not set, it should be >default. REPEATABLE READ? I believe, correct me if I am wrong:tomcat.connection.commit() calls mysql.connection.commit(), Is it possible thatactually operating-system-file-writing not finished when the calls return? or there is a delay, or updating query haslower priority, either tomcat or mysql? The following connectioncall is a 'select' statement without delay, so 'select' statement executed before operating-system-file-writing finished. It sounds that you did not hear similar issues. Thanks. ---------------------------------------------------------------------To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor additional commands, e-mail: users-h...@tomcat.apache.org