[BEST] way to Measure and Optimize Server VN Performance

May 23, 2019

Want to measure server performance and speed up your server VN by more than 20%? Let’s find the answers in this article! [VinaHost.VN]

The BEST way to Measure and Optimize Server VN Performance

 

I. Essential server performance metrics you should be considering

1. Hardware utilization

First, let’s talk about overall hardware utilization. Any app or server running is limited by the resources allocated to it. Therefore, keeping track of the utilization of resources is the key, primarily to determine if a resource bottleneck exists. When considering these, you are looking for what can become a key resource for the whole system. This metric can tell you what physical component can be updated to improve server performance.

You have these aspects to consider:

  • CPU (processor): CPU Utilization is the amount of CPU time used by the Web-App while processing a request. It is usually the percentage of CPU usage that is calculated, which indicates how much of the processor’s capacity is in use by your app. When the percentage of CPU usage begins at 100% that means there may be problem in your app or shortage of capacity deficiency of the server in Vietnam.
  • RAM (memory): Memory Utilization refers to the amount of memory used by a Web App while processing a request. It is usually calculated as the process’s percentage of memory utilization, which is a ratio of the Resident Set Size (real occupied memory size) to the physical memory.
  • The disk space and usage

2. HTTP Error Rates (HER)

Generally, some errors can occur when processing requests, especially when under a big load.

HER is measured as a percentage of problem requests relative to all requests, and it reflects how many response HTTP status codes indicate an error on the server VN – including any requests that never get a response. HER is a significant metric because it measures “performance failure” in the app and tells you how many failed requests have occurred at a particular point in time.

  • 200 or 3xx error codes indicate a redirect on the server.
  • 4xx & 5xx error codes mean the web server knows it has a problem fulfilling that request.

Normally, nobody can define the tolerance for Error Rate in their web app. Normally you should try to minimize possible errors (Error Rate of less than 1%) to avoid performance problems as well as work constantly to eliminate them.

>>> [5 Tips] Guides to choose Cheap Vietnam Hosting (FAST)

3. The Count of threads

A web app can generate lots of threads to process requests. The number of threads is an important metric as the number of threads per process is normally limited by the system. The count of existing threads is proportional to the load and inversely proportional to the processing time of the requests.

So if your app generates too many threads, then it may be an indicator that there is a problem in the app.

4. Peak Response Times (PRT)


PRT measures the round trip of request/response cycles, however the peak will tell us what the longest cycle is at that point in the test.

In the case where the average calculation may be sub-second, you may still not be troubled and just consider that there is no problem yet. But, when the ART and PRT start becoming comparable, that indicates that you undoubtedly will have a problem in your server Vietnam.

Generally, Peak Response Times shows that at least one of the resources is potentially problematic. It can reflect an anomaly in the app, or it can be due to “expensive” database queries…

5. Average Response Times (ART)

 

By PRT (standard measurement unit of PRT is recommended to be milliseconds) measures the round trip of request/response cycles and the peak will tell us what the longest cycle is at that point in the test. It shows that at least one of the resources is potentially problematic.

If we are looking at a graph that is showing a 5 minute monitoring period and the PRT is 13 seconds that means one of our requests took that long. In the case where the average calculation may be sub-second, you may still not be troubled.

However, if the ART (Average Response Times) and PRT start becoming comparable, undoubtedly you have a problem in your Vietnam server.

Generally, it can reflect an anomaly in the app, or it can be due to “expensive” database queries.

>>> What is VPS? How to choose cheap VPS Vietnam for your business?

6. The Count of Open Files Descriptors (OFD)


Files descriptors are an object that a process uses to read/write to an open file and to open network sockets. The number of file descriptors that a process may open will be placed on limits by an Operating System.

A shortage of available file descriptors can cause a wide variety of symptoms which are not traced back to easily. The OFD provides a count of the total number of file descriptors that are currently allocated and open for processing. The percentage of all open file descriptors with respect to the maximum allowed count of descriptors for processing is a good indicator for evaluating the performance of a web app.

7. Uptime

 

Uptime is the amount of time that a server VN has stayed up and running properly.

It reflects the availability and reliability of the server, that means this rate should be as high as possible. Usually, a value less than 99% should lead to attention and less than 95% is to troubling.

8. Requests per Second (RPS)

 

Requests-per-Second is the evaluation of how many requests/second are being sent to a target server. This indicator is called average load and it allows you to understand what load your web app currently works under.

This is measured as a count of the requests received during a measurement period, where the period is represented in seconds. The monitoring period is usually in the range of 1 – 5 minutes. The lengthening of the measurement period leads to an undesirable “smearing” of the load indicator.

>>> [TOP] 3 things to before purchasing Server Vietnam

II. How to optimize and speed up your server?

1. Fine tune your web server

As your site traffic patterns and site complexity changes, your web server settings need to be tweaked to maintain ideal resource usage.

It is best to have your web servers audited once a month if your site needs to constant updates.

Here are a few settings that need to audit and tweak if you use Linux Vietnam server and Apache:

  • Keep Alive: When you turn on “Keep Alive”, Apache uses a single connection to transfer all the files to load a page. This saves time in establishing a new connection for each file.
  • Timeout determines how long Apache will wait for a visitor to send a request. This has to be set based on the server traffic. In busy server Vietnam, you can set it up to 120 seconds. However, it is best to keep this value as low as possible to prevent resource wastage.
  • Keep Alive Timeout ensures that a Keep Alive connection is not abused. It indicates that how long Apache should wait for a new request before it resets the connection. 10 secs to be a good limit for heavily loaded servers.
  • Max Keep Alive Requests determines how many files can be transferred via a Keep Alive connection. Unless there is not enough resource constraint, this setting can be set as “unlimited”.
  • Hostname Lookups: Apache can try to find out the hostname of every IP that connects to it, but that would be a wastage of resources. To prevent that, you can set Hostname Lookups to “0”.
  • Min Spare Servers & Max Spare Servers: Apache keeps a few “workers” on stand-by to handle a sudden surge of requests. Min Spare Servers value of 10 and Max Spare Servers value of 15 to be a good limit for a heavily loaded server in Vietnam.
  • Max Clients tells Apache how many visitors can be served simultaneously. Setting Max Clients too high will cause resource wastage while setting it too low will result in lost visitors. So you should set it at an ideal value based on the visitor base.

2. Upgrade to SSD

The biggest drag on server VN performance is disk I/O. That is the time taken for the hard disk to spin to collect all the data your site needs.

SSD has functions like the server memory, so get an SSD disk for at least your database partition. It can cut down your load time by close to 10%.

3. Setup a fast reverse proxy

Your server Vietnam sends HTML files to a visitor’s browser. What if another visitor requests the same file?

Using a HTTP reverse proxy will be a solution. It sits between your server and the visitors. If a second customer asks for the same file, it’ll quickly serve the file from memory quickly.

Here are the top of popular web servers that can be configured as a reverse proxy.

  • Nginx is the favorite reverse proxy for the top heavy sites.  It has proven to be reliable against traffic spikes, and is a safe bet because of its stability and customizability.
  • Varnish is more complex than Nginx to deploy. However, sites with heavy traffic and a lot of content will be speed up see considerable gain in speed with Varnish.
  • Lighttpd – If you have a heavy site and resource usage spikes are common, Lighttpd can help the most. It is light and not likely to drag down the server.

Besides, there are many options such as SquidApache or IIS but these above are successful options.

4. Choose the right application server

Many app owners use apps that’s installed by default in their VN server (for example CentOS server uses PHP 5.4 instead of latest PHP 7.2 with Fast CGI Process Manager that has enormous speed advantages).

They may not know the differences and keep trying to optimize their site code to x speed issues. They can be able to improve app load speeds by more than 100% in some cases just by changing the app server, tweaking the settings to match the site load, and enabling cache.

5. Turn on HTTP/2

Actually there not many users are aware of HTTP/2 benefits.

Currently, all web servers use HTTP protocol v1.1 by default. But they all have support for HTTP v2 that is the latest version with many performance improvements. It improves server response time by:

• Using a single connection instead of parallel connections to transfer files

• Using compression to speed up header transfer

• Pushing all files needed to render a page before it is requested by the browser

• Using binary data instead of text data transfer

However, you need to configure the followings when setting up HTTP/2:

• Switching the whole site to HTTPS (You will need to set redirects for site link.

• Ensure that your reverse proxies are properly configured for HTTP/2.

• Upgrade your webserver to a version that supports server PUSH.

Besides, HTTP/2 requires you to use SSL certificate that make your site more secure by default.

6. Fix your DNS query speed

 

Google wants your server VN to respond within 200 milliseconds.

And DNS queries are the biggest threat to that kind of loading speed.

There are not many site meet this requirement. This is especially true for traffic from outside their hosted country. As the distance between browser and DNS server increases, it will take more time for execution.

The only way to fix this is to use a distributed DNS cluster. You can get 3 low cost VPS in different area (Asia, America, Europe..), and then configure and optimize master-slave DNS servers in all of them.

7. Defragment your database tables & optimize server settings

All modern websites use databases to store site content, product data and more.

All activities like posting new comments, adding new pages, modifying or removing older pages and adding or removing listed products leave “holes” in the database tables. These “holes” are where a data was deleted, but was never filled back in. It is called “fragmentation” process and can cause longer data fetch times.

Database tables that have more than 5% of it’s size as “holes” should be fixed. Therefore, you should check your database tables for fragmentation each month and run an optimization query to keep your site from turning sluggish.

Every time you upgrade your web app or add a new plugin/mod