Squid2.5 performance optimization process and squid. tgz download

Source: Internet
Author: User
Tags automake
So far, after the optimization of squid2.5, the cpu usage is better than squid3.0 twice, and the stability is very good. I haven't tested squid2.6, because this 2.5 is already very good. In a single file download system, it is not a big problem to run 15 thousand of established on a single machine. The installation optimization process involves two steps: Add epoll

So far, the squ optimized in this articleId2.5, itsCpThe u usage is twice higher than squid3.0, and the stability is very good. I haven't tested squid2.6, because this 2.5 is already very good. In a File Download System, run the 15 thousand establish command on a single machine.EdNo.

The installation optimization process involves two steps: Install the epoll patch and use google_perftoo.LsFirst, make sure that the system kernel is above 2.6.

1. Install the epoll patch

Epoll patch is relatively difficult to install, because it needs automake-1.5 and autoconf-2.13, so I am generally a big tgz package copy around with, but did not find any problem. Here I will organize the compilation and installation process. If you are interested, you can try it.

The operating system I used to compile this machine is Red Hat Enterprise Linux Server release 5 (Tikanga). I own automake1.5, but I still don't know how to use this 1.5.

Install autoconf2.13 first

Cd/Root
Wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.13.tar.gz
Tar-xzf autoconf-2.13.tar.gz
Cd autoconf-2.13
./Configure
Make
Make install

Then install automake1.5

Cd/root
Wget http://mirrors.kernel.org/gnu/automake/automake-1.5.tar.gz
Tar-xzf automake-1.5.tar.gz
Cd automake-1.5
./Configure
Make
Make install

Both of these files are installed under/usr/local/bin/, and the same file exists under/usr/bin, in this step, I will execute:

Su-

Log on again

Download the epoll patch, which is available on the official site of squid.

Http://devel.squid-cache.org/old_projects.html#epoll

It takes a long time to get it. If you cannot download it, you can download it from sudone.

Http://www.sudone.com/download/squid_epoll.Patch

Find the latest version of squid2.5 to download.

Http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE14.tar.bz2

I recently found a software called Xunlei, which can be quickly downloaded. I recommend it to you.

Release the patch after the patch is installed.

Cd squid-2.5.STABLE14
Patch-p1 <../squid_epoll.patch

Run the patch.

./BootsTrAp. sh

Check to avoid wasting time Compiling. If we see a bunch of warnings, it proves that the compilation is successful. Otherwise, although the compilation is successful, the compilation is wrong.

Start configure, make, make install

./Configure -- prefix =/usr/local/squid --Enable-AsyNc-I/O = 256 -- enable-cache-digests -- disable-ident-LookUp -- enable-removal-policies = heap lru -- disable-snmp -- enable-dlmalloc -- enable-Kill-Parent-hack -- enable-underscores -- enable-delay-pools -- enable-epoll -- disable-poll -- disable-WcCp -- disable-select -- with-maxfd = 65535 -- with-aio -- with-large-FileS -- enable-err-language = English, Simplify_Chinese -- enable-default-err-language = Simplify_Chinese
Make-j20
Make install

After the execution, you can execute thisCommandCheck Results:

Strings/usr/local/squid/sbin/squid |GrepEpoll_ctl

If there is output, it turns out everything is fine.

In this case, a squid that supports epoll is compiled, and then configured with the configuration file and permissions to start using it. I deleted the error interface in the share directory under squid in addition to Chinese and English, and then typed several packages for direct download and use. However, these packages must be placed in the corresponding directory before they can be used. If they are placed in another directory, useLn-S soft link chain can be used normally to the corresponding directory.

Download squid2.5 _ epoll_home.tgz (in the/home/squid directory)
Download squid2.5 _ epoll_usr_local.tgz (in the/usr/local/squid directory)

2. Install google_preftools

Squid works with this stuff to improve the performance, but I don't know how to test it, but after some systems are used, it turns out to be more stable.

You can download the latest google_perftools

Http://code.google.com/p/google-perftools/

Install it. I have a ready-made script.

#! /Bin/sh

If [-s/usr/lib/libtcmalloc. so]; then
Echo google_perftools installed
Else

If ['Uname-R |Egrep-C ^ 2.6 '-eq 1]; then
Echo install google_perftools
Cd $ {BASE_DIR} download
Wget-q http://google-perftools.googlecode.com/files/google-perftools-0.97.tar.gz
Tar-zxf google-perftools-0.97.tar.gz
Cd google-perftools-0.97
If ['uname-m | grep-c 64'-eq 1]; then
./Configure -- prefix =/usr -- enable-frame-pointers> &/dev/null
Else
./Configure -- prefix =/usr> & amp;/dev/null
Fi
Make-j10> &/dev/null
Make install> &/dev/null
Cd $ OLD_PWD
Else
The echo Linux kernel version must be later than 2.6 to install google_perftools.
Fi

Fi

# End

Run the command to install it, change the squid startup command, and remember to limit the number of system files.

Ulimit-N 65535
LD_PRELOAD =/usr/lib/libtcmalloc. so/usr/local/squid/sbin/squid-DV

It can be used after the startup is successful, which is relatively simple.

I have a general configuration file here. Just change it.

After the work is done, the 2.5 squid becomes a powerful enough cache Server, and the cpu usage is only 10%-20% when the cpu usage is high. The load-able established quantity is estimated to reach 20 thousand.

--------------------

Today, a friend reported that the downloaded binary file cannot be used because it was compiled on Redhat AS5. Today I re-compiled it with Redhat AS4, the execution in Redhat AS4/5, Ubuntu8.10/7.10/6.6, and debian etch/testing is normal. If you have any questions, please email me.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.