How to optimize db queries that use AJAX?


I'm currently developing a MVC system with PHP/JS/HTML that uses AJAX for taking data from the db.
Our main problem right now are the Autocomplete fields: they take a lot of the server and client resources. Is there anyway to optimize them? (server caching, less event listeners, etc?) .

Are there any other type of asynchronous events that I should optimize for a better speed with this system?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
The question is a bit open ended. Without knowing more about your system, data, usage, codebase, AJAX implementation, data queries etc we are flying blind here.

You need to be more specific about what you want to know and provide some data / code etc so that we have something to work with.

Generally you want to design your code so that you are not hitting the server unnecessarily - so with Autocomplete - only do a lookup after a certain number of characters has been typed - or implement a delay from first keypress to when you actually do the lookup.

In your database you want to make sure your queries are optomised, your tables have appropriate indices defined etc.

Caching - always an option to consider but specific to the implementation - so yes look at caching but can't say how without knowing more about your data.

Are there any other type of asynchronous events that I should optimize for a better speed with this system?
Where is the bottleneck - client or server. If server you want to do more work on the client - if client see if you can optomise  by sacrificing look and feel for speed - where appropriate.

Check for library glut - are you using a gazillion libraries for functionality that is only a small % of those libraries - investigate if you can maybe not implement that functionality yourself or find a leaner library that does the same thing.

Just off the top of my head.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.