« Squid version 2.4 与 2.4 2.5 在FreeBSD上的表现 | Main | [news] nagios 2.0b4 released »
August 2, 2005
epoll poll select - squid compile options
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 https://windtear.net/archives/2005/08/02/000733.html http://windtear.net/archives/2005/08/02/000733.html epoll poll select - squid compile options 依次优先 有epoll用epoll 没有就用poll (epoll比较好些 需要打squid补丁和操作系统epoll库支持) http://devel.squid-cache.org/cgi-bin/diff2/epoll-2_5.patch?s2_5 http://www.xmailserver.org/linux-patches/epoll-lib-0.11.tar.gz POLL(2) Linux Programmer's Manual POLL(2) NAME poll - wait for some event on a file descriptor SYNOPSIS #include <sys/poll.h> int poll(struct pollfd *ufds, unsigned int nfds, int timeout); fds是一个结构指针 struct pollfd { int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; 指向一组需要检测的文件描述符 nfds是这个集合的大小 大小比较大的时候 就出现了瓶颈 造成了极大的资源浪费 Redhat RPM默认是 --enable-poll 的 Summary: The Squid proxy caching server. Name: squid Version: 2.4.STABLE6 Release: 6.7.3 Serial: 7 %configure \ --exec_prefix=/usr --bindir=/usr/sbin --libexecdir=/usr/lib/squid \ --localstatedir=/var --sysconfdir=/etc/squid \ --enable-poll --enable-snmp --enable-removal-policies="heap,lru" \ --enable-storeio="aufs,coss,diskd,ufs" \ --enable-delay-pools --enable-linux-netfilter \ --with-pthreads \ --enable-auth-modules="LDAP,NCSA,PAM,SMB,MSNT" # --enable-icmp SELECT(2) Linux Programmer's Manual SELECT(2) NAME select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing SYNOPSIS /* According to POSIX 1003.1-2001 */ #include <sys/select.h> /* According to earlier standards */ #include <sys/time.h> #include <sys/types.h> #include <unistd.h> int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); int pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask); FD_CLR(int fd, fd_set *set); FD_ISSET(int fd, fd_set *set); FD_SET(int fd, fd_set *set); FD_ZERO(fd_set *set); |
Posted by windtear at August 2, 2005 6:40 PM