Answer the question
In order to leave comments, you need to log in
Where does the huge difference in server response speed come from?
Hello. I can't figure out what happened to the backend. There were 1300 records in the database. Synthetically increased to 33800 and the horror began. When directly accessing the page address, the content is generated in 0.001 seconds, when I load using ajax, the timeout increases to 1 second. Checked with absolutely identical parameters. The site has a gallery, the pagination of which is implemented through ajax requests. At the moment the page is loaded, there is a request to receive 1, and after it, 2 pages. So, the first page is loaded in 1 second, the second, as expected, is given in ~ 22 ms (gzip eats up part of the time). If you load not 2 pages, but more, then all the pages following the first one are loaded normally. When you go, say, to the 300th page, both 300 and 301 are loaded approximately the same - 0.5 seconds. At first I thought that the problem was with LIMIT x, y, but why is it still returned in 0.0001 seconds when directly accessing any page? Tell me where to dig.
Answer the question
In order to leave comments, you need to log in
Most likely, the query in the database is designed so that caching works, this is very good, but it creates the appearance that the 2nd query is executed quickly.
It is necessary to look towards query optimization, table structure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question