In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to improve the efficiency of TPS by removing Nginx. It is very detailed and has a certain reference value. Friends who are interested must read it!
1. Why remove or use Nginx?
In some cases, people will still insist on using agents like Nginx, which I will list for you below. For Raygun, our API server hosts only one application and then exposes it to the Internet only through load balancing devices. This means that restrictions on port sharing do not apply to us, and openness to external services has been minimized.
Some of the reasons we may want to use agents (from a blog post from Microsoft) are listed as follows:
Restrict the public portion of its managed application
Provide additional configuration and defense layer
Facilitate better integration with existing infrastructure
Simplify load balancing and secure communication (HTTPS) configuration. Only the reverse proxy server requires an X.509 certificate, and the server can use HTTP to communicate with the application server on the internal network.
Https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#when-to-use-kestrel-with-a-reverse-proxy
two。 Business performance after removing Nginx
For our API node, removing Nginx from the configuration allows us to process more requests at no extra cost.
Through the load test, we also found that the average response time and the 99th percentile response time of the request were significantly improved. This means that our customers request API services faster and allow them to send more data per unit of time.
Since the new server configuration was put into production, our load balancing devices have reported 5xx errors greatly reduced. Now, we can handle higher client loads, and users encounter fewer error problems.
3. How do we test the performance of .NET Core
We tested it in the environment of Amazon's AWS c5.large instance Ubuntu 18.04. The benchmark server runs Nginx and Kestrel Web services, with Nginx acting as a Kestrel Web service proxy; in contrast, on another server, service requests are handled directly by Kestrel.
We use Apache JMeter to publish the Raygun Crash Reporting sample payload to the service API. JMeter can simulate a very high concurrent request load. We constantly adjust this so that each server makes the most of CPU, approaching the limit that service overload will not be able to handle all requests (but still guarantee a 100% success rate of requests).
Https://raygun.com/platform/crash-reporting
Run multiple tests using JMeter, each lasting 10 minutes, and generate a save test summary report at the end of each test.
Finally, we take the average of the results of many tests, and finally get the following test results.
4. The result display after removing Nginx
Response time (milliseconds)
The average response time (the smaller the value, the better performance) is reduced from 1.2ms to 0.8ms, which is equivalent to a 33% reduction, and the 99th percentile response time is reduced from 6ms to 4ms, equivalent to a 33% reduction.
TPS
TPS (the higher the value, the better performance) increased from 3783 to 5461, equivalent to a 44% increase.
5. Observation of running the new configuration service in the production environment
Memory usage
When running the service instance using Nginx, the average memory used by each instance is very consistent, with memory usage between 13% and 16%.
Since the removal of Nginx, we have seen the memory usage of service processes increase, ranging from 15 to 30 per cent, with an average of 22 per cent. We are convinced that this is because Nginx limits the number of requests processed by Kestrel.
As a result, Kestrel always processes requests at a certain rate under high concurrency, which means that memory usage has hardly changed much. After eliminating this bottleneck, because Kestrel handles a varying number of requests, we can now see more memory usage and changes.
Nginx + Kestrel
Kestral only
Average number of active nodes
The average number of active nodes decreased from 5.35 to 4.66. Now, we can see that there are only four servers running for quite a long time, while at the peak of the same period, we are also running fewer servers than we used to use Nginx.
Nginx + Kestrel
Kestral only
5xx error rate of load balancing equipment
For some time, we have found that the 5xx error rate is very high in the information report based on load balancer devices, as shown in the following figure. These errors did not come from our application, and they were not identified as faults and reported in Raygun.
Originally, these errors came from Nginx, and by removing this agent, we can now better handle full load and greatly reduce the occurrence of failures.
Overall, because of the large number of requests processed by our server, even the higher numbers below account for only a small portion of the total number of requests we handle. Note that significant performance improvements can be achieved by deleting the Nginx layer, which is commendable. We are not criticizing or denying Nginx, of course, it may be the final configuration problem of our Nginx, but simplifying the configuration seems to solve this problem better.
The above is all the content of the article "how to improve TPS efficiency by removing Nginx". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.