Please wait...

How does the server build and what does it need CPU, HDD and Memory for.

How does the server build and what does it need CPU, HDD and Memory for.

How much memory needed for my server?

This is very common question but not so easy to answer. For example, for small site based on WordPress with simple design and about 100 visitors per day 0.5 Gigabyte should be enough.

We will tell you a little bit more about how server memory allocated. We will use WordPress as an example and will try to avoid being too technical, therefore IT gurus should skip this article – they will not find anything new here.

Ddrdrive_x1WordPress coded on PHP, commands set called “script” by many, which is true for most of coding languages. Thus, when you want to read some blog, PHP-FPM server (we like it more than Apache) compute some set of codes to show you nicely designed result. Server need some memory and its volume depends on design complexity and coder (who developed code) experience. In average, WordPress needs about 70 Megabyte per one script. Be careful now – this means 70 Megabyte per visitor per query. In other words for two simultaneous visitors 140 megabyte will be needed, and for 10 it is already 700 Megabyte… Hold on a minute, our server has only 512 Megabyte memory. Yes, yes. And we need some memory for database as well (MySQL in our case). So we limit number of queries by 3.

It is more complicated with MySQL. How much memory needed depends on number of connections, database size, coder (who coded requests) experience, number of buffers used and other parameters, each depends on another and all of them affects functionality. Let’s just set MySQL in a way that it will not consume more than 200 Mb of memory. By doing so we can serve 20-30 connections to not-so-big database. Connection is not the number of visitors. One executed script could connect more than once; there could be few scripts in a cue, wait… We promised simple explanations. Well, 20-30 connections to MySQL are more than just sufficient to serve 3 to 5 simultaneous visitors on your site.

And we made it…. Well… There is something not good enough. PHP-FPM could take about 210 Mb, MySQL 200 Mb, means 410 in total. And we need memory for operating system and Nginx server. Let’s reduce PHP-FPM connection number to 2 and limit MySQL to 150 Mb. Now we have 290 Mb. We have memory for OS and Nginx. Not much. Let’s compute – 2 connections, 30 sec each gives us… Gives us 1440 pages processed by server. E.g. this is a number of times that server capable generate and display new page. If your visitors checking 5 pages per visit – you (and your site) can serve 288 visitor per day.

Is it possible to increase number of visits without having server down?

Yes. You have to setup Nginx microcache. This will allow showing pages stored on disk cache. This means there is no need any more to generate page every time. Number of visitors will increase but it is hard to say to which level. Maybe three times more, maybe two… It depends on a pages storing time in cache, how often it reloaded, how many pictures on a page, how well scripts coded. There is too many cross-dependant parameters.

Now you understand that increased number of visitors means increased used memory and server load. The more scripts you need to handle, the more powerful processor needed. For the moment we should say that quiet many web applications exist that need more powerful processor then bigger memory.

About processors and fast HDD (and what they are needed for) we surprise you some other time.

We can setup your server or server stack to handle higher load.

Leave comments

You must be logged in to post a comment.