KillerPHP Blog

Speed up PHP with JSON and AJAX

January 27, 2014



So we decided to work on streamlining and speeding up StudioWeb’s basic functionality. When it comes to user perceptions of a web application’s speed, the most important thing to look at is the request/response cycle. But first, the most obvious thing you can do, is to just increase your server’s speed:

  • More RAM
  • More CPU
  • Faster disk drives
  • Empty disk drives – <50% full disk always move much faster.

… New servers are coming very soon to StudioWeb. In the meantime though, there are things you can do the application’s code itself.


StudioWeb makes heavy use of AJAX to submit answers to the server for processing. So we decided to utilize JSON to send the data – rather than posting just a raw strings of text. What we get out of this, is a much faster response time from the users point of view.

To use JSON, you Typically use JavaScript

If you are sending post request via standard post and not AJAX, you can’t take advantage of JSON, since JSON is a function of JavaScript – meaning, it is all about creating JSON objects with JavaScript and the only way to use JavaScript in the request/response cycle, is to use AJAX … or specifically, the XMLHttpRequest() object.

… But now I am getting deep into nerd territory. All you need to take away is that using JSON to pass information to and from a server can speed up things a lot.

Stefan Mischook