½â¾öLinuxÖÐToo many open filesÎÊÌâ
1¡¢Ïà¹ØÃüÁ
ulimit –a //²é¿´µ±Ç°ÉèÖÃ
ulimit –n 2048 //¼´Éè³É2048£¬°´Êµ¼ÊÐèÒªÉèÖÃ
2¡¢Óû§»·¾³²ÎÊýÎļþÅäÖãº
ÔÚ/etc/profileÖмÓÈëÈçÏÂÄÚÈÝ£º
if
[ $SHELL
=
"
/bin/ksh
"
]; then
ulimit
-
p
16384
ulimit
-
n
65536
else
ulimit
-
u
16384
-
n
65536
fi
3. ÐÞ¸Ä /etc/security/limits.confÎļþÖÐÉèÖÃ×î´ó´ò¿ªÎļþÊý
Ìí¼ÓÈçÏÂÕâÐС£
* - nofile 30000
ÕâÐÐÉèÖÃÁËÿ¸öÓû§µÄĬÈÏ´ò¿ªÎļþÊýΪ30000¡£×¢Òâ"nofile"ÏîÓÐÁ½¸ö¿ÉÄܵÄÏÞÖÆ´ëÊ©¡£¾ÍÊÇÏîϵÄhardºÍsoft¡£ÒªÊ¹Ð޸ĹýµÃ×î´ó´ò¿ªÎļþÊýÉúЧ£¬±ØÐë¶ÔÕâÁ½ÖÖÏÞÖÆ½øÐÐÉ趨¡£ Èç¹ûʹÓÃ"-"×Ö·ûÉ趨, ÔòhardºÍsoftÉ趨»áͬʱ±»É趨¡£
* hard nofile 65535
* soft nofile 65535
Ïà¹ØÎĵµ£º
Linux ÄÚºËÖÐµÄ GCC ÌØÐÔ(ת£©
Á˽âÓÃÓÚ C ÓïÑ﵀ GCC À©Õ¹
ÎĵµÑ¡Ïî
<tr
valign="top"><td width="8"><img alt="" height="1" width="8"
src="//www.ibm.com/i/c.gif"/></td><td width="16"><img alt=&qu ......
°²×°ÊµÀý£ºImageMagickµÄ°²×°·½·¨
ImageMagickµÄ°²×°·½·¨ÓÐRPM·½Ê½ºÍSOURCE·½Ê½¡£Ä¿Ç°×îаæÊÇImageMagick-6.5.5¡£¿ÉÒÔ´ÓÕâ¸öÍøÖ·ÏÂÔØ£º http://www.imagemagick.org
°²×°²½Ö裺
£±£®sshÁ¬½ÓLinux·þÎñÆ÷
£²£®°ÑÏÂÔØµÄ°²×°Îļþ·Åµ½Êʵ±µÄÎļþ¼ÐÏ¡£ÀýÈ磺cd /usr/local/src¡£»òÕßÖ±½ÓÔÚ·þÎñÆ÷ÉÏÏÂÔØ¡£
3£®½âѹÏÂÔØÎļ ......
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main()
{
printf("sizeof(off_t) = %d\n", sizeof(off_t));
int ......
class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex ......