{"id":29588,"date":"2016-11-03T23:57:55","date_gmt":"2016-11-03T21:57:55","guid":{"rendered":"https:\/\/blog.superhosting.bg\/en\/?p=29588"},"modified":"2022-06-01T13:07:34","modified_gmt":"2022-06-01T10:07:34","slug":"are-you-ready-for-black-friday-part2","status":"publish","type":"post","link":"https:\/\/blog.superhosting.bg\/en\/are-you-ready-for-black-friday-part2.html","title":{"rendered":"You Own a Server? Is it Ready for Black Friday? (Part 2)"},"content":{"rendered":"<p>In <a title=\"Is Your Online Store Ready for Black Friday 2016? (Part 1) - Blog SuperHosting.BG\" href=\"https:\/\/blog.superhosting.bg\/en\/are-you-ready-for-black-friday-part1.html\">the previous article<\/a> we told you how to prepare your online store for Black Friday by finding a suitable hosting service. We also gave you a few optimization tips.<\/p>\n<p>In part 2 I would like to give you some pieces of advice if you are using \u0430 <a title=\"VPS (virtual servers) by SuperHosting.BG\" href=\"https:\/\/en.superhosting.bg\/web-hosting-page-servers-vps.php\" target=\"_blank\" rel=\"noopener noreferrer\">virtual server<\/a> or <a title=\"Dedicated servers by SuperHosting.BG\" href=\"https:\/\/en.superhosting.bg\/web-hosting-page-servers-dedicated.php\" target=\"_blank\" rel=\"noopener noreferrer\">dedicated server<\/a>.<\/p>\n<p style=\"padding-left: 15px; padding-right: 15px;\">These services provide you with full root access that enables you to analyze them in a more detailed way. On the other hand, <a title=\"CPU time?! Performance Statistics and Optimization! - Blog SuperHosting.BG\" href=\"https:\/\/blog.superhosting.bg\/en\/cpu-statistics-optimization.html\" target=\"_blank\" rel=\"noopener noreferrer\">CPU time<\/a> is the parameter that helps you analyze your resources. For that reason the following lines are going to be more technical in nature.<\/p>\n<div class=\"tipsupport05\">Firstly you need to find out the current CPU load.<\/div>\n<p>There is an index called <strong>Load Average<\/strong> in Linux that shows total value of the CPU load. The current Load Average is displayed with the \u201e<strong>top<\/strong>\u201c command.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"img-border2 aligncenter wp-image-29525 size-full\" src=\"https:\/\/blog.superhosting.bg\/wp-content\/uploads\/2016\/11\/blackfriday-part-2-server-top-load-avg-superhosting-01-1.png\" alt=\"Load Average\" width=\"636\" height=\"90\"><\/p>\n<p>The lower the numbers, the better (watch out the second and third number). Generally a threshold value means that the Load Average should not exceed the number of CPU cores on the server. This rule might give you an overall idea whether your server is overloaded. The threshold value means that the Load Average should not exceed the number of cores multiplied by 2. Higher numbers might represent overloaded websites.<\/p>\n<p>If CPU load increases linearly depending on the number of users, we can suppose that if the number of our website visits doubles, the load will also double. In such cases the Load Average value goes very high. So you can either increase the number of CPU cores or optimize in other ways. Do not forget to increase proportionally the RAM along with the CPU cores!<\/p>\n<p>Here is a simple example \u2013 you own a server with 4 CPU cores. Usually your website reaches about 5000 page views per day. So the Load Average value is 0.5. If we accept that on Black Friday you will reach a total of 30000 page views, we can calculate that:<\/p>\n<p>0.5 * (30000 \/ 5000) = 3<\/p>\n<p>Your Load Average value equals <strong>3<\/strong>. You have a server with 4 CPU cores available so we accept that it could handle the load. However, we might expect most users to visit your website for a short period of time \u2013 for example from 10:00 to 15:00. In such case it is a great idea to ensure 100 % server interruptibility. So we now calculate:<\/p>\n<p>3 * (1 + 100%) = 6<\/p>\n<p>Now the CPU load is higher than the number of cores you have available and you need to increase their number (in your case with at least 50% \u2013 from 4 to 6). You also need to increase the RAM. If your server used to have 4GB RAM, now make it at least 6GB.<\/p>\n<p>In many cases, however, increasing the number of visitors to your website leads to nonlinear increase of CPU load so it is possible that the server load increases more than expected. This is a specific situation depending on the web application used and its settings.<\/p>\n<p>Our recommendations for calculating the necessary resource are just basic and do not cover all possible case scenarios. So it is better to consult an expert for a more detailed analysis.<\/p>\n<p><strong>For further optimization you might take the following steps:<\/strong><\/p>\n<ol>\n<li><strong>Check whether most of the load is coming from<\/strong> \u2013 the scripts or the database. Thus you will be able to focus on the more critical aspect. My tips for <a title=\"Is Your Online Store Ready for Black Friday 2016? (Part 1) - Blog SuperHosting.BG\" href=\"https:\/\/blog.superhosting.bg\/en\/are-you-ready-for-black-friday-part1.html\">optimizing PHP and slow queries<\/a> from our previous article are still 100% valid!<\/li>\n<li><strong>Make sure that the server load is not caused by input\/output disk operations.<\/strong> You can use the \u201e<strong>iostat<\/strong>\u201c command and check the value of \u201e<strong>%iowait<\/strong>\u201c in the result. If the value is above 10% it is a good idea to consider optimizing. Sometimes the best solution is adding more RAM to the server. It does miracles with iowait. But if the load is caused by many slow queries you should deal with them.<\/li>\n<li><strong>If your system allows this, install web caching software that caches whole pages<\/strong> and works \u201ein front\u201c of your web server. This way pages will be directly loaded from the cache without sending requests to scripts and the database. Varnish and Nginx (works as reverse proxy) are among the most popular <a title=\"Caching Systems and Web Acceleration - Blog SuperHosting.BG\" href=\"https:\/\/blog.superhosting.bg\/en\/web-cache-web-accelerators.html\">caching solutions<\/a>. \u0441\u0430 Varnish \u0438\u043b\u0438 Nginx (\u0440\u0430\u0431\u043e\u0442\u0435\u0449 \u043a\u0430\u0442\u043e reverse proxy). Please note that installing such software might be very time consuming and the changes need to be implemented into the code by a developer.<\/li>\n<li><strong>Try to use object caching in the system itself such as Memcache or Redis.<\/strong> You will most probably need a developer for the implementation.<\/li>\n<li><strong>Create a separate static landing page<\/strong>, to redirect part of the users on Black Friday. You can set up a cron job to generate a landing page from your website&#8217;s home page.<\/li>\n<li><strong>Check your web server settings, the database and PHP.<\/strong> Very often when performing more complex optimizations we miss upgrading different settings on the server or database. This leads to inefficient increase of server resources. In case you expect more visitors, start your optimization with MaxClients in Apache, or max-connections and max_user_connections in MySQL.<\/li>\n<\/ol>\n<p>To test your server behavior when it needs to handle many users, you can use <a title=\"ab - Apache HTTP server benchmarking tool - httpd.apache.org\" href=\"http:\/\/httpd.apache.org\/docs\/2.4\/programs\/ab.html\" target=\"_blank\" rel=\"noopener noreferrer\">Apache Bench<\/a>. This software enables you to simulate numerous simultaneous visits on your website and to track whether the server can deal with them. You can find further information for Apache Bench on the official website: <a title=\"ab - Apache HTTP server benchmarking tool - httpd.apache.org\" href=\"http:\/\/httpd.apache.org\/docs\/2.4\/programs\/ab.html\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/httpd.apache.org\/docs\/2.4\/programs\/ab.html<\/a><\/p>\n<p>If you need further technical assistance, our high qualified sysadmins are always available to help you. Do not forget that most often optimization requires to be performed by experienced developers.<\/p>\n<div class=\"tipsupport05\">Black Friday is just around the corner. Do not leave optimizing for the last moment so that you can benefit from Black Friday as much as possible.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>See what determines whether your server ready for Black Friday! And how to assure it for moments of peak visits to your website.<\/p>\n","protected":false},"author":28,"featured_media":66449,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[110],"tags":[365,182,295],"class_list":{"0":"post-29588","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-superhosting-technology-en","8":"tag-black-friday-en","9":"tag-server-resources","10":"tag-vps-virtual-servers"},"aioseo_notices":[],"modified_by":"\u041c\u0430\u0434\u043b\u0435\u043d\u0430 \u041c\u0435\u0442\u043e\u0434\u0438\u0435\u0432\u0430","post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/posts\/29588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/comments?post=29588"}],"version-history":[{"count":3,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/posts\/29588\/revisions"}],"predecessor-version":[{"id":66450,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/posts\/29588\/revisions\/66450"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/media\/66449"}],"wp:attachment":[{"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/media?parent=29588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/categories?post=29588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.superhosting.bg\/en\/wp-json\/wp\/v2\/tags?post=29588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}