About memory in wordpress
The fact that wordpress eats a lot of memory, I think everyone knows. I occasionally post on my blog some posts that may be useful in
optimizing wordpress .
In order to reduce the memory consumed by wordpress, I, in the footsteps of Max, did a direct translation of wordpress 2.6.5 and wordpress 2.9, with which, in principle, I am satisfied. The hard translation of the engine allowed to reduce 3-4 MB of RAM and allowed to generate the page a little faster, but the potential of multilingual was lost. Simple users, far from all these “Internet tricks”, are quite difficult to install / update wordpress on their own, although I personally think it's worth it!
Sergey Biryukov was written a plugin that allows not so well as in the direct translation, but largely solve the problem of memory costs for localization. He wrote a very useful plugin
Pure PHP Localization , which allows you to reduce memory consumption by 2-3 MB in wordpress. In addition, the plug-in also reduces the memory consumed by the files and plug-in locations and themes the fewer plug-ins you have on the blog with Russian localization, the tangible the increase will be.
')
I decided not to distribute and completely refuse to distribute direct wordpress 2.9 translation. Because The method implemented by Sergey is out of the box. Those. does not require any gestures from the user. Just put and activated in the admin panel. The difference in memory between these methods is small and not worth it.
ru_RU_lite
This method is most likely known to everyone and has long been widely used - the use of lightweight files localization ru_RU_lite.
The native ru_RU localization file contains the translation of the entire engine and the akismet plugin (I don’t use it, so the localization file can be shortened to a file by several dozen lines). On the site itself, many lines of the localization file that are used in the admin panel are not needed, but they take up memory without any benefit. To prevent this from happening, the translation file ru_RU_lite is used, which contains only the necessary translation lines and weighs several times less. This allows you to reduce the order of 1 MB of memory, it all depends on the hosting settings and so on. You can also do with the localization files of the plug-ins (in the template you just need to rename the localization file).
In the assembly of Ivan Kalinin (Lecactus), the ru_RU_lite file is already in the distribution and in the wp-config.php file there are all the necessary strings that allow using a lightweight translation. You just need to uncomment these lines (y).
If you do not have the files en_RU_lite.po and ru_RU_lite.mo in the \ wp-content \ languages ​​\ directory, then you can download the lite translation files
here or find them on Ivan Kalinin’s website and in the wp-config.php file instead
define ('WPLANG', 'en_US');
to add
if (strpos ($ _ SERVER ['REQUEST_URI'], 'wp-admin')) define ('WPLANG', 'en_RU'); else define ('WPLANG', 'ru_RU_lite');
Indicators on my localhost before applying the above methods
Memory consumption: 14.777MB
After:
Memory consumption: 11.599MB
Php eaccelerator
Installing on php eaccelerator hosting allows you to reduce the memory consumed wordpress several times. My VDS Php eaccelerator has reduced memory consumption by 9 times !!! The blog consumes only 1.5 MB of memory.
I cannot say for sure and correctly due to what this increase is going on, I think, if you are interested, you can learn about the principles of work on the Php eaccelerator project. Who understands php, I think, will prompt correctly, precisely and clearly what is happening there.
Wordpress Queries
There are two ways to reduce queries to the database:
1) Full page caching.
2) query caching
Much has already been written about full-page caching, so I will not focus on this much attention. I just want to give a link to a relatively fresh
overview of full-page caching plugins for wordpress.
For information on caching queries in wordpress, we also go to
Vladimir Kolesnikov . I wrote about this
wonderful plugin , which allows you to greatly reduce the number of database queries. On pure wordpress 2.9 with default templates, the number of queries to the database is reduced from 19 to 3 !!! Thanks to Vladimir! The more plugins you have installed and the more queries to the database your template makes, the more tangible savings you get.
Requests in premium templates
The main sources of additional requests are mostly plug-ins, but templates also make "extra" queries to the database.
In premium themes for wordpress it happens that on the theme settings page in the admin panel you can make various settings, which, in principle, is convenient for ordinary users. But often, each option is implemented as a separate get_option ('name_option') request, where 1 field corresponds to 1 value, which sometimes causes unnecessary accesses to the database and makes the database a bit "solid". You can combine all values ​​into an array and save the result in 1 field. Because In order to remove all the necessary theme settings, only 1 query to the database is made, the fact that the query is a bit "harder", I think you can ignore. From 2 evils choose the smaller.
Other
The optimization process has no boundaries)
In this post, I wanted to touch on the most effective ways to optimize wordpress, which I know and use. There are also many ways to make the site work “faster”, ranging from combining images into sprites to web server settings.
In conclusion ... the alexpts.ru blog consumes 1.3 MB of memory and makes 12 queries to the database from the main page.