Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

WordPress has a framework in place for handling AJAX which is well documented here: http://codex.wordpress.org/AJAX_in_Plugins

My concern with this is that every time you execute an AJAX query, (even if you want to return a single field from a table) this framework instantiates the whole WordPress stack, including any plugins and theme functions that may exist on your site. This strikes me as a pretty heavy method to perform what may end up being a pretty simple function.

Typically a lot of WordPress sites run on shared hosting and don't have a whole lot of processing power, so, based on my experiences, a reponse time of 2 seconds to a WordPress hosted AJAX call is not uncommon.

Any recommendations on how to improve on this response time?

share|improve this question
    
Did you read this wordpress.stackexchange.com/questions/41808/…? –  toscho Feb 26 '13 at 12:31

1 Answer 1

up vote 1 down vote accepted

The crude alternative most people resort to is the one where you add a file and include several levels up. This is arguably worse for performance if not just as bad.

But there is a variant that works better, if we create our own AJAX entrypoint URL, and specify:

define( 'SHORTINIT',true);

Then include the WordPress environment, we can skip over the majority of the loading process. This is the way to go if you want super zippy AJAX requests. The downside is that we have to load some things ourselves, and some steps of the loading process are never executed.

See this answer for more detail Ajax takes 10x as long as it should/could

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.