for each request, and HA to solve the database single point of failure3) Use shared storage to save sessionShared storage is a single point that can be resolved through raid4) Use memcached to save sessionSimilar to the database, but because of memory access, the performance is much better than the database, but if the memcached server down, the session will be lost, in the extended Tomcat 6.x, using mecac
CentOS6.6 32-bit Minimal version: Install Nginx Mysql PHP Memcached and centos6.6nginx
CentOS is a free and stable Linux version released by Red Hat. Minimal is used in enterprise server applications, because Minimal is the CentOS "Purest" server system, even the vim editor of Minimal must be installed by yourself. Minimal has the least components, no desktop, and flexible scalability. It is very suitable
Nginx works in a multi-process manner, with a master process and multiple worker processesThe master process is used to manage worker processes(1) Send a signal to each worker process(2) Monitor worker processes, and when a worker process has an exception, a new worker process is started.The master process will first establish a socket,fork function to listen to the generation of sub-process workers, inherit scoket, generally speaking, when there is a
I. Environmental preparedness1. First introduce the environment, and our protagonists todayI use the environment is minimized installation of the centos7,mariadb (rumors of MySQL after the acquisition of Oracle, people worried like Java as destroyed in Oracle's hands as a new branch, but still like MySQL),php7.1.0 (version does not matter, are 7 version), nginx1.10 (we installed stable version without blindly pursuit of new), memcached, and Redis can
Test machine: 192.168.18.207, 192.168.18.208,192.168.18.209
Software configuration:
192.168.18.207
nginx/1.9.4
192.168.18.208
tomcat-7.0.64
memcached-1.2.0
192.168.18.209
tomcat-7.0.64
memcached-1.2.0
System version:
Click (here) to collapse or open [root@localhost ~]# cat/proc/version L
Memcached and nginx concurrency models, one is a model of single-process and multi-thread, and the other is a classic multi-process and single-thread model. By comparison, we will deepen our understanding of the two concurrency models.
First, analyze the application scenarios of the two.
Commonalities:
Two applications, one is the cache service and the other is the Web service. They are applications that ha
First, you need to compile a third party module (ngx_http_consistent_hash) for Nginx 1. Download Ngx_http_consistent_hash-master, unzip2. View installed Nginx compilation parameters:/usr/local/nginx/sbin/nginx-v3. Nginx Decompression directory to perform:./configure--prefix=
nginx+tomcat+memcached Load Balancer Configuration complete process:Objective:Nginx realizes The load balance of Tomcat and uses memcached to realize session sharing.
Configure TOMCAT,JDK First
Put jdk,Tomcat into the site /opt directoryInstalling the JDKCd/optchmod 755 jdk-6u45-linux-x64-rpm.bin./jdk-6u45-linux-x64-rpm.binjava-version//Inspection
The Tomcat cluster session synchronization scheme is available in several ways:
With the cluster method of Tomcat, it is easy to configure the session information automatically in real-time with multiple tomcat. However, this scheme is inefficient and does not perform well in large concurrency. Principle: http://zyycaesar.iteye.com/blog/296606
Using Nginx's IP-based hash routing strategy, it is easier to ensure that IP access is always routed to the same tomcat. But if th
Build Nginx + tomcat + MySQL + memcached environment.The top map is as follows650) this.width=650; "title=" clipboard "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; " Border= "0" alt= "clipboard" src= "Http://img1.51cto.com/attachment/201409/28/4489523_1411913447dh84.png" height= " 398 "/>Java programs need to run on Tomcat, and Tomcat is a Java program. This Java program is req
=/usr/local/libmemcachedMake make installCompilation is normalAdd extension = memcached. So to the php. ini file.
Compile and install php_memcache, which is different from the memcached extension.This extension can be used in windows, but the function is not as good as above. If the configuration is the same, it will not be written.
**************************************** ***Install and configure
as root)-m maximum memory usage, in megabytes. Default 64MB-M running out of memory and returning an error instead of deleting an item-c Maximum number of simultaneous connections, default is 1024-F Block size growth factor, default is 1.25-N Minimum allocated space, key+value+flags default is 48-H Display HelpExample: C:\memcached\memcached.exe-hThree: Tomcat configuration1. Required JAR Packagesuch as the following list:memcached-session-manager-1.
}Reload () {Echo-n
"ReLoad INg
Prog: "Kill-hupcat ${nginx_pid}Killproc $nginxd-hupRetval=$?Echo}See how we were called.Case "$" inStartStart;;StopStop;;ReloadReload;;RestartStopStart;;StatusStatus $progRetval=$?;;*)Echo
u s a g e :
Prog {start|stop|restart|reload|status|help} "Exit 1EsacExit $RETVALTo give Nginx Execute permissions:[Email protected] nginx-1.7.0]# chmod 775
1 cause
Recently, a stress test was conducted on the newly developed web system, and it was found that the response speed of concurrent logon home pages under Tomcat's default configuration pressure to 600 people was severely affected, more than 2000 errors of 500 and 502 occur in one round. I made a look at the logon time statistics and printed out the total server processing time. I saw that some responses were indeed within 20 seconds, however, the average time is far different from that test
/test.jsp, when different host accesses are scheduled to be processed on different Tomcat instancesrequests from the same host are handled by the same Tomcat instance , where you drop the currently responding Tomcat Realexample , Nginx automatically dispatches the user's request to another Tomcat instance , and the session is not discarded. This article is from the "ptallrights" blog, make sure to keep this source http://ptallrights.blog.51cto.com/11
duplicated.3. Check if memcached is startedNetstat-antTCP 0 0 202.207.177.177:11211 0.0.0.0:* LISTPort 11211 is already open, indicating that memcached has started normally.4. Restart PHP nginxService php-fpm Restart #重启php-fpmService nginx Restart #重启nginxIv. Environmental testing of MemcacheRun the following PHP file, if there is output this is a test!, it ind
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.