Haproxy is a free and open source software written in C that provides high availability, load balancing, and TCP and HTTP-based application proxies that can run on most major Linux operating systems.This experiment uses three servers to build a Web cluster, haproxy as a dispatch server, two Nginx servers as node servers.Experimental environmentHost | System | IP Address | As long as the software
1. Foreword
Reference Http://www.oschina.net/p/haproxyHAProxy,HAProxy provides high availability, load balancing. and proxies based on TCP and HTTP applications to support virtual hosts, which is a free, fast, and reliable solution. Haproxy is especially useful for Web sites that are heavily loaded, which typically require session maintenance or seven-tier processing.
Environment Preparation:
Host Name
Role
IP Address
my linux1.contoso.com
haproxy server eth0:192.168.100.121 eth1 : 172.16.100.121
Mylinux3.contoso.com
Web server 1
eth0:192.168.100.181
Mylinux4.contoso.com
Web server 2
eth0:192.168.100.182
First, the preparatory workInstall the HTTP service on MYLINUX3 and mylinux4 and start.Yum-y Install h
phenomena
Haproxy bind 4 Core CPU, 8 core CPU, 16 core CPU, when the pressure is measured, will appear CPU 100% is used situation.
Tracing Process
1. Through the Mpstat-p all 1 command to see where the CPU is used, you can see most of the CPU used in the SYS state.
2. View the Haproxy process through Strace-p pid-c the system call takes up the most CPU and sees the CPU used on the Connect system call.
3
HAProxy high concurrency Problem Solving
Directory
1. Problem Description2. Problem Analysis3 HAProxy Positioning3.1 connect (...)3.2 tcpv4_connect_server3.3 call of tcpv4_connect_server3.4 call of connect_server3.4 modify source code to add custom logs3.5 srv_dynamic_maxconn4 solutions5. Email Exchange with the author of HAProxy5.1 email description5.2 reply from the recipient5.3 resend the verification an
With regard to haproxy log configuration, We separately describe that the default haproxy log is output to the system syslog, which is not very convenient to view. In order to better manage haproxy logs, we generally define them separately in the production environment. The method is as follows:
First, modify the log configuration options of
Haproxy is a powerful, flexible and easy to use reverse proxy software, provides a high-availability, load-balanced, back-end server Agent functions, it is in the 7-tier load balancing function is very powerful (support cookie track, header rewrite, etc.), support dual-machine hot standby, support virtual host , has a very good server health check function, when its agent's back-end server failure, Haproxy
Haproxy provides high availability, Load Balancing and proxies based on TCP and HTTP applications that support Virtual Host , it is a free, fast and reliable solution. Haproxy is especially useful for Web sites that are heavily loaded, and often require session-hold or seven-tier processing. Experiment (I.)Experimental purpose: Using Haproxy to do load balancing
TCP counter listenoverflows a large increase
View Method
Cat/proc/net/netstat | awk '/tcpext/{print $21,$22} '
reason
The queue length of the system call listen function (int listen (int sockfd, int backlog) is determined by min (backlog, kernel parameter net.core.somaxconn), corresponding to the listen of the socket When the queue is full, the listenoverflows counter adds 1 when a new connection is added.
Solution
Adjust system Parameters Net.core.somaxconn = 65535 #默认为128
Cat 65535 >/proc/sys
Load Balancing with HaproxyFirst, the conceptHaproxy is a free and open source software written in the C language [1] that provides high availability, load balancing, and application proxies based on TCP and HTTP.Haproxy is especially useful for Web sites that are heavily loaded, and often require session-hold or seven-tier processing. The haproxy runs on the current hardware and can support tens of thousands of concurrent connections. and its operati
I. PrefaceHaproxy is a stable, high-performance, and high-availability server Load balancer solution that supports HTTP and TCP proxy backend server pools. It is widely used as an HTTP reverse proxy because it supports powerful and flexible layer-7 acl rules. This article describes in detail how to use its layer-4 switching and Keepalived to implement a Load balancer, suitable for any TCP services such as Socket, ICE, Mail, Mysql, and private communication. The system architecture diagram is as
Nginx/lvs/haproxy Load Balancer software pros and consHttp://www.ha97.com/5646.htmlPs:nginx/lvs/haproxy is currently the most widely used three load balancing software, I have been implemented in a number of projects, reference to some information, combined with some of their own experience, summed up.The general use of load balancing is to use different technologies depending on the stage of the site's asc
Haproxy performs Load Balancing for mysql and haproxymysql1. First install haproxywget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.24.tar.gztar zcvf haproxy-1.4.24.tar.gzcd haproxy-1.4.24Make TARGET = linux26 PREFIX =/usr/local/ha
Tags: Linuxkeepalived + haproxy + MySQL build high availability1, the high availability of keepalived is the main preparation, there is a standby2, keepalived + haproxy built high-availability is can be scheduled for two high-availabilityTopology diagram:Keepalived: Responsible for preemption of virtual IP, using VRRP protocolHaproxy: Responsible for the access scheduling, reduce the single point of pressur
ROTTEN: haproxy learning https configuration, haproxyhttps
This article is sponsored by ilanniweb and first published onThe world
For more articles, follow my ilanniweb.
Some time ago, I wrote a few articles about learning haproxy. Today, we will introduce the https configuration of haproxy. We will not introduce the advantages of https.
We will only introduce ho
Build a Web cluster using Haproxy
Haproxy provides high availability, load balancing, and proxies based on TCP and HTTP applications, supporting virtual hosting, which is a free, fast, and reliable solution. The haproxy runs on the current hardware and can support tens of thousands of concurrent connections. and its operating mode makes it easy and safe
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.