Your cart is currently empty!
What happens when a user visits or clicks on a website?
The user’s browser opens a web address (URL), which connects to the web server OS, passes through the firewall, and reaches the webserver software(i.e. Nginx). The webserver software responds to the user’s access request.
The webserver’s response can be of the following kinds:
- html, js, css and image, kind of static resource. The webserver sends these resources directly to the user.
- Cached page. The webserver sends the files in the cache folder directly to the user.
- Pages must be generated by PHP. The webserver connects to PHP and forwards the user’s request to PHP. In most cases, PHP needs to connect with MySQL to retrieve data from MySQL, and then through PHP calculation and processing, generate pages, send them back to the webserver, and then send them to the user.
WordPress is in charge of the 3rd response above.
WordPress, in response to every request from a user, in the vast majority of cases, runs all of the code for the entire WordPress, including the code for the theme and all the plugins. The plugin’s code runs before the vast majority of WordPress code.
The problem here is that every request (visit click) of the user does not want to get all the information about the website, such as just looking at one of the dozens of pages of the website. But with each request, the entire code of the website has to be run once, or even more times (in some cases where Ajax is not handled properly).
Plugins are generally code that implements some specific functionality. Unfortunately, even if the user sees a page that has nothing to do with the functionality of some of the plugins, the plugin’s code will still run. As for how much of the plugin’s code will run, it depends on the design of the plugin code.
Javascript issues.
Javascript is commonly used to handle page elements, as well as to load other Javascript code. The biggest problem is that in some cases, Javascript generated pages cannot be cached.
This is how we can optimize the performance of our website
- Minimize Javascript dependencies so that more pages can be cached.
- Transfer the function of the plugins to the webserver and OS to reduce the use of the plugin. Plugins are written in PHP and Javascript. The code in webserver and OS is written in C, which is much much faster than PHP code. Such alternative plugins are optimization plugins, and security plugins.
- Try to take advantage of the features of WordPress itself and use fewer plugins. For example, we can use multi-site to achieve multi-language support. Page build plugins, which automatically generate huge bloated page code, should not be used as much as possible.
- Pay attention to the selection of plugins. Some plugins rely on third-party resources, or plugins have their own servers. The operation of such plugins depends on the response speed of third-party resources and/or the plugin’s own server, which may have an uncontrollable impact on performance.
- Replace some functions of WordPress with WP-CLI. For example, detach the wp-cron scheduled task from WordPress to WP-CLI run. In this way, user’s access click does not have to be accompanied by a wp-cron task, thus improving user experience.
wpmobile theme is carefully designed with performance as it’s priority.
Leave a Reply