jQuery的$就调用函数是缓慢的第一次函数、缓慢、jQuery

2023-09-11 01:37:26 作者:骨子里的高雅

我使用$就来更新数据库中的值。当页面使Ajax调用的第一次,它是缓慢的。它正在像5或6秒钟将返回结果。在第一次请求之后,它是快速。我不知道是否有一种方法,使第一个电话也快。如果您有任何意见,请让我知道。

I am using $.ajax to update some values in the database. when the page makes the ajax call for the first time, it is slow. it is taking like 5 or 6 seconds to return the result. after the first request, it is fast. I am not sure if there is a way to make the first call also fast. if you have any ideas, please let me know.

谢谢, 斯里达尔

推荐答案

我的怀疑是,该数据库是做一些缓存和后续请求从缓存中填充的。如果这是仅发生在数据的第一请求,而不管所涉及的数据,然后我会怀疑是你连接到需要的web服务也可以加载到存储器上的第一操作

My suspicion would be that the database is doing some caching and subsequent requests are filled from the cache. If this were only happening on the first request of the data, regardless of the data involved, then I would suspect that the web service that you're connecting to needs to be loaded into memory on the first operation.