开发者

Drupal is extremely slow handling simple AJAX calls

开发者 https://www.devze.com 2023-01-21 03:28 出处:网络
I wrote a simple AJAX callback function in Drupal that performs a query to the DB and returns a JSON formatted string. Nothing fancy, the standard AJAX declaration in the module with a modest amount o

I wrote a simple AJAX callback function in Drupal that performs a query to the DB and returns a JSON formatted string. Nothing fancy, the standard AJAX declaration in the module with a modest amount of information (less than 4KB). The query to the database takes 52ms. Drupal adds around 320ms of overhead for a total of 370ms + latency. And that in my development machine (only one user)...

Is this normal? Do you know h开发者_运维技巧ow you can decrease that huge overhead?

Context: - Clean install - No extra modules - Without the Drupal cache. I want to know the real performance of Drupal (I'm starting to be really concerned about how slow this is - I didn't expect it). - APC opcode cache activated

Thanks in advance, Juan

P.D.: At some point I was wondering what'd be the real effect of no having a connection pool to the DB like Java frameworks, and running the whole PHP script every time. Maybe I'm starting to see the performance problems of using PHP?


Use js module to handle your ajax requests. You can specify only really necessary modules and includes required for you callback. It helps save about 30-70% time for your requests and even more, if you use cache to store processed data.

0

精彩评论

暂无评论...
验证码 换一张
取 消