1. Installation and startup steps
1. Upload the installation package to the server
TongHttpServer-5.0.0.1-1.ky10.ky10.aarch64.rpm
2. Execute the following command to install THS, the default installation path is opt/TongWeb/THS
rpm -ivh TongHttpServer-5.0.0.1-1.ky10.ky10.aarch64.rpm
Install other paths: rpm -ivh –relocate /=/opt/THS TongHttpServer-5.0.0.1-1.ky10.ky10.aarch64.rpm
3. The THS main program needs a license to start. It supports TW Enterprise Edition, Security Edition and THS license. You only need to put the license.dat file in the THS directory or the THS directory at the same level.
4. Start, enter the bin directory, execute ./start.sh , and the startup is successful if it appears as shown in the figure below
2. Web application configuration and startup verification
1. Edit configuration file
- Port number configuration
<VirtualHost addr:[port]></VirtualHost> where the value of addr is ip address (ipv6 address needs to add square brackets, such as [2002:db80::a00:20ff:fea7:cceb]), *, _default_, _default _ is an alias for *.
- application configuration
DocumentRoot: Material directory, configured according to the directory where various material files are actually stored.
ProxyPassMatch: url regular match
ProxyPassMatch ^(/.*\.jpg)$ !: Indicates that all requests in jpg format are not forwarded
ProxyPassMatch ^(/.*\.jpg)$ http://backend.example.com means that all jpg requests will be forwarded to the backend, such as http://example.com/imgae/file.jpg, will be Forward to http://backend.example.com/imgae/file.jpg
<VirtualHost IP:8080>
DocumentRoot "/opt/THS/mng"
ProxyPassMatch ^(/.*\.jpg)$ !
ProxyPassMatch ^(/.*\.png)$ !
ProxyPassMatch ^(/.*\.js)$ !
ProxyPassMatch ^(/.*\.css)$ !
ProxyPassMatch ^(/.*\.html)$ !
ProxyPassMatch ^(/.*\.gif)$ !
ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness stickysession=ROUTEID
ProxyPassReverse / balancer://tongSSLCluster/
ServerName www.test.com
ServerAdmin [email protected]
</VirtualHost>
-
Multi-application configuration
can put multiple applications in the same directory, as follows
<VirtualHost IP:8080>
DocumentRoot "/opt/TongHttpServer/mng"
ProxyPassMatch ^(/.*\.jpg)$ !
ProxyPassMatch ^(/.*\.png)$ !
ProxyPassMatch ^(/.*\.js)$ !
ProxyPassMatch ^(/.*\.css)$ !
ProxyPassMatch ^(/.*\.html)$ !
ProxyPassMatch ^(/.*\.gif)$ !
ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness stickysession=ROUTEID
ProxyPassReverse / balancer://tongSSLCluster/
ServerName www.test.com
ServerAdmin [email protected]
</VirtualHost>
2. Restart ths middleware
1. cd /opt/THS/bin
2. ./start.sh restart
3. Reverse proxy configuration and startup verification
1. Edit configuration file
-
The port number
<VirtualHost addr:[port]></VirtualHost> where the value of addr is ip address (ipv6 address needs to add square brackets, such as [2002:db80::a00:20ff:fea7:cceb]), *, _default_, _default _ is an alias for *.
-
proxy configuration
<VirtualHost IP:8080>
DocumentRoot "/opt/THS/mng"
ProxyPassMatch ^(/.*\.jpg)$ !
ProxyPassMatch ^(/.*\.png)$ !
ProxyPassMatch ^(/.*\.js)$ !
ProxyPassMatch ^(/.*\.css)$ !
ProxyPassMatch ^(/.*\.html)$ !
ProxyPassMatch ^(/.*\.gif)$ !
ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness stickysession=ROUTEID
ProxyPassReverse / balancer://tongSSLCluster/
ServerName www.test.com
ServerAdmin [email protected]
</VirtualHost>
Parameter Description:
ProxyPass:
"/": the path of the webpage in the url, which means all requests
"balancer://balancerID/": balancer tag, balancerID is the name of the balancer
"growth": supports dynamically increasing the number of worker nodes
"maxattempts": maximum number of reconnection attempts
"nofailover": Configure failover, off is off, on is on
"timeout": configure the connection timeout
"lbmethod": Configure the load algorithm, the default "bybusyness" algorithm.
ProxyPassReverse:同ProxyPass
Cluster address configuration
<Proxy balancer://tongSSLCluster> BalancerMember http://IP:8089 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp BalancerMember http://IP:8090 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp </Proxy>
Parameter description: Proxy: the label of the working node cluster
BalancerMember: specify a working node
Loadfactor: load factor, the larger the factor, the greater the scheduling weight, the value is 1-100 42
Lbset: The initial loading value, used in the polling algorithm. The initial value decreases to a negative value after N scheduling cycles, and the first scheduling starts. The smaller the Lbset, the earlier the scheduling. The default is 0.
Route: route=serverN session affinity configuration, refer to session affinity configuration.
Redirect : redirect=serverM means that when the node fails, redirect to serverM.
Hcmethod: Health check method, you can choose TCP, GET, HEAD, among which hcuri must be configured for GET and HEAD, the main difference between GET and HEAD is the returned message, if you need the worker node to return a complete page, use GET, just return HTTP Header uses HEAD.
hcuri: Health check purpose web page.
hcinterval: Indicates the health check cycle.
Secret: ajp password, used when the working node is ajp
For multi-application configuration, multiple Listeners can be configured, and each Listener can be configured with its own <VirtualHost addr:[port]></VirtualHost>; as shown below.
Listen 8080 <Proxy balancer://tongSSLCluster> BalancerMember http://IP:8089 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp BalancerMember http://IP:8090 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp </Proxy> <VirtualHost IP:8080> DocumentRoot "/opt/THS/mng" ProxyPassMatch ^(/.*\.jpg)$ ! ProxyPassMatch ^(/.*\.png)$ ! ProxyPassMatch ^(/.*\.js)$ ! ProxyPassMatch ^(/.*\.css)$ ! ProxyPassMatch ^(/.*\.html)$ ! ProxyPassMatch ^(/.*\.gif)$ ! ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness stickysession=ROUTEID ProxyPassReverse / balancer://tongSSLCluster/ ServerName www.test.com ServerAdmin [email protected] </VirtualHost> Listen 8081 <Proxy balancer://tongSSLCluster> BalancerMember http://IP:8089 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp BalancerMember http://IP:8090 loadfactor=1.0 lbset=0 hcmethod=TCP hcinterval=30 hcuri=/index.jsp </Proxy> <VirtualHost IP:8080> DocumentRoot "/opt/THS/mng" ProxyPassMatch ^(/.*\.jpg)$ ! ProxyPassMatch ^(/.*\.png)$ ! ProxyPassMatch ^(/.*\.js)$ ! ProxyPassMatch ^(/.*\.css)$ ! ProxyPassMatch ^(/.*\.html)$ ! ProxyPassMatch ^(/.*\.gif)$ ! ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness stickysession=ROUTEID ProxyPassReverse / balancer://tongSSLCluster/ ServerName www.test.com ServerAdmin [email protected] </VirtualHost>
2. Restart ths middleware
1. cd /opt/THS/bin
2. ./start.sh restart
4. Common commands
1. Install command
rpm -ivh –relocate /=/opt/THS TongHttpServer-5.0.0.1-1.ky10.ky10.aarch64.rpm
2. Start command
Enter the installation directory/bin and execute ./start.sh
3. Stop command
Enter the installation directory/bin and execute ./start.sh stop
4. Restart command
Enter the installation directory/bin and execute ./start.sh restart
5. Performance comparison of common application middleware
-
Scenario 1: http request front-end page high concurrency comparison
1. The main comparison of this scenario is that when both THS and nginx have deployed the same front-end static project, do a front-end page request stress test to compare the response time.
2. The following are the test results
Concurrency response time (ms) middleware |
TongHttpServer |
TongHttpServer (Number of processes: 8 Maximum number of connections: 10240) |
TongHttpServer (Number of processes: 48 Maximum number of connections: 10000) |
Nginx |
Nginx (Number of processes: 8 Maximum number of connections: 10240) |
100 |
2.6 |
4.4 |
4.6 |
1 |
1 |
500 |
2.2 |
2.4 |
2.6 |
1 |
1 |
1000 |
2 |
3.2 |
3.2 |
1 |
1 |
2000 |
2.2 |
2.2 |
1.6 |
1.6 |
1.2 |
5000 |
3.2 |
6.6 |
7.8 |
3.8 |
2.6 |
10000 |
11.2 |
20.6 |
28.2 |
4.6 |
9.2 |
20000 |
5.2 |
21 |
28.2 |
3.8 |
5.8 |
Summary: 1) As the number of processes increases, TongHttpServer responds relatively slowly;
2) As an application container, there is not much difference between ths and nginx under the default parameters;
-
Scenario 2: Reverse proxy request service response time comparison
1. This scenario mainly compares the same back-end service of ths and nginx reverse proxy, and makes a stress test of service calls to compare the response time.
2. Reverse proxy request service response time comparison
Concurrency response time (ms) middleware |
TongHttpServer |
TongHttpServer (Number of processes: 8 Maximum number of connections: 10240) |
TongHttpServer (Number of processes: 48 Maximum number of connections: 10000) |
Nginx |
Nginx (Number of processes: 8 Maximum number of connections: 10240) |
100 |
4 |
3.2 |
3.4 |
1.2 |
5 |
500 |
5.2 |
4.2 |
2.6 |
1 |
2 |
1000 |
2.2 |
2.2 |
2 |
1 |
1 |
2000 |
3 |
2.4 |
3.4 |
1.6 |
2 |
5000 |
4.4 |
6 |
2 |
1.8 |
2.2 |
10000 |
22.4 |
7.8 |
5.8 |
3.6 |
10.2 |
20000 |
104 |
107.2 |
31.6 |
102.4 |
17.8 |
Summary: 1) THS responds faster and faster as the number of processes increases;
2) When the number of processes is 8 and the concurrency is less than 10,000, the performance of THS and Nginx (the number of processes is 8) is similar; when it is 20,000, Nginx is better than THS;
-
Test detailed data
Test detailed data;:
After tuning:
6. Involving downloads
1. TongHttpServer-5.0 User Manual
https://download.csdn.net/download/zhb15810357012/87794668
2. Test data and data results after tuning
https://download.csdn.net/download/zhb15810357012/87794673
3. Test report