LinuxϵͳÀú³Ì×ÊÔ´ÏÞÖÆÓ¦¶ÔÒªÁì
ÔõÑùÓ¦¶ÔlinuxϵͳÖеÄÀú³Ì×ÊÔ´ÏÞÖÆÎÊÌâ
ͻ񻣼
ÔÚLinuxϵͳÖУ¬Àú³Ì×ÊÔ´ÏÞÖÆÊÇΪÁËÑÚ»¤ÏµÍ³£¬±ÜÃâ¶ñÒâ³ÌÐò»ò¹ýʧ²Ù×÷µ¼ÖÂϵͳÍ߽⡣±¾ÎĽ«ÏÈÈÝÔõÑùÓ¦¶ÔlinuxϵͳÖеÄÀú³Ì×ÊÔ´ÏÞÖÆÎÊÌ⣬°üÀ¨ÔõÑùÉèÖúÍÐÞ¸Ä×ÊÔ´ÏÞÖÆ£¬ÒÔ¼°ÔõÑùÓÅ»¯×ÊԴʹÓá£
Ò»¡¢Ã÷È·Àú³Ì×ÊÔ´ÏÞÖÆ
Àú³Ì×ÊÔ´ÏÞÖÆÊÇͨ¹ýÄں˲ÎÊýÉèÖÃÀ´ÊµÏֵģ¬Ëü¶ÔÀú³ÌµÄÐéÄâÄÚ´æ¡¢ÎïÀíÄÚ´æ¡¢CPUʹÓá¢ÎļþÐÎò·ûµÈ×ÊÔ´¾ÙÐÐÏÞÖÆ£¬ÒÔ°ü¹ÜϵͳµÄÎȹÌÐԺͿÉÓÃÐÔ¡£ÔÚĬÈÏÇéÐÎÏ£¬LinuxϵͳΪÿ¸öÀú³ÌÉèÖÃÁËһЩ»ù±¾µÄ×ÊÔ´ÏÞÖÆ£¬µ«¿ÉÄܲ¢²»Öª×ãÏÖʵÐèÇó¡£
¶þ¡¢ÉèÖúÍÐÞ¸Ä×ÊÔ´ÏÞÖÆ
Éó²éÄ¿½ñ×ÊÔ´ÏÞÖÆ£º¿ÉÒÔʹÓÃulimitÏÂÁîÀ´Éó²éÄ¿½ñÀú³ÌµÄ×ÊÔ´ÏÞÖÆ£¬Èçulimit -aÏÂÁî¿ÉÒÔÁгöËùÓеÄ×ÊÔ´ÏÞÖÆ¡£ÕâЩ×ÊÔ´ÏÞÖÆÒÔÈíÏÞÖƺÍÓ²ÏÞÖÆΪÁ½ÖÖÀàÐÍ£¬ÈíÏÞÖÆÊÇÀú³ÌÄ¿½ñ¿ÉÓÃ×ÊÔ´µÄÉÏÏÞ£¬¶øÓ²ÏÞÖÆÊÇ×ÊÔ´µÄ×î´óÉÏÏÞ¡£¿ÉÒÔͨ¹ýulimit -SÏÂÁîÉèÖÃÈíÏÞÖÆ£¬Í¨¹ýulimit -HÏÂÁîÉèÖÃÓ²ÏÞÖÆ¡£
ÐÞ¸Ä×ÊÔ´ÏÞÖÆ£ºÍ¨¹ýulimitÏÂÁî¿ÉÒÔÐÞˢг̵Ä×ÊÔ´ÏÞÖÆ£¬µ«ÕâÖÖÐÞ¸ÄÖ»¶ÔÄ¿½ñµÄshell»á»°ÓÐÓá£ÈôÊÇÒªÓÀÊÀÐÞ¸Ä×ÊÔ´ÏÞÖÆ£¬¿ÉÒÔ±à¼/etc/security/limits.confÎļþ£¬ÔöÌí»òÐÞ¸ÄÏìÓ¦µÄÉèÖÃÏî¡£ÀýÈ磬soft nofile 1024ÌåÏÖ½«ÎļþÐÎò·ûµÄÈíÏÞÖÆÉèÖÃΪ1024£¬hard nofile 4096ÌåÏÖ½«ÎļþÐÎò·ûµÄÓ²ÏÞÖÆÉèÖÃΪ4096¡£ÐÞ¸ÄÍê±ÏºóÐèÒªÖØеǼ»òÖØÆôϵͳ²Å»ªÉúЧ¡£
Èý¡¢ÓÅ»¯×ÊԴʹÓÃ
ºÏÀíÉèÖÃ×ÊÔ´ÏÞÖÆ£ºÔÚÉèÖÃ×ÊÔ´ÏÞÖÆʱ£¬ÐèҪƾ֤ÏÖʵÐèÇóºÍϵͳ×ÊÔ´ÇéÐÎÀ´µ÷½â¡£¹ý¸ßµÄÏÞÖÆ¿ÉÄܵ¼ÖÂϵͳ¸ººÉ¹ý´ó£¬¹ýµÍµÄÏÞÖÆ¿ÉÄÜÓ°Ïì³ÌÐòÔËÐС£¿ÉÒÔÍŽáϵͳ¼à¿Ø¹¤¾ßÀ´ÆÊÎö×ÊԴʹÓÃÇéÐΣ¬°üÀ¨CPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊ¡¢ÎļþÐÎò·ûÊýµÈ£¬Æ¾Ö¤ÏÖÕæÏàÐε÷½â×ÊÔ´ÏÞÖÆ¡£
ʹÓÃ×ÊÔ´ÖÎÀí¹¤¾ß£ºÔÚLinuxϵͳÖУ¬ÓÐһЩ×ÊÔ´ÖÎÀí¹¤¾ß¿ÉÒÔ×ÊÖúÓÅ»¯×ÊԴʹÓá£ÀýÈ磬ʹÓÃcgroup¿ÉÒÔ¶ÔÀú³Ì¾ÙÐзÖ×éÖÎÀí£¬²¢·ÖÅÉÏìÓ¦µÄ×ÊÔ´ÏÞÖÆ£»Ê¹ÓÃniceºÍreniceÏÂÁî¿ÉÒÔµ÷½âÀú³ÌµÄÓÅÏȼ¶£¬ºÏÀí·ÖÅÉCPU×ÊÔ´£»Ê¹ÓÃsystemd¿ÉÒÔ¶ÔЧÀ;ÙÐÐ×ÊÔ´¿ØÖƺÍÓÅ»¯¡£
±àдÓÅ»¯´úÂ룺ÔÚ±àд³ÌÐòʱ£¬¿ÉÒÔ˼Á¿ÓÅ»¯×ÊԴʹÓá£ÀýÈ磬¿ÉÒÔºÏÀíÖÎÀíÎļþÐÎò·ûµÄ·¿ªºÍ¹Ø±Õ£¬×èÖ¹ÎļþÐÎò·û×ß©£»¿ÉÒÔͨ¹ýʹÓÃÄÚ´æ³ØµÈÊÖÒÕÀ´ïÔÌÄÚ´æËéƬ»¯£»¿ÉÒÔʹÓöàÏ̻߳òÀú³Ì³ØÀ´ºÏÀíʹÓÃCPU×ÊÔ´¡£
½áÂÛ£º
ÔÚLinuxϵͳÖУ¬Àú³Ì×ÊÔ´ÏÞÖÆÊÇÈ·±£ÏµÍ³ÎȹÌÐԺͿÉÓÃÐÔµÄÖ÷ÒªÊֶΡ£Í¨¹ýÏàʶºÍÉèÖÃ×ÊÔ´ÏÞÖÆ£¬ÒÔ¼°ÓÅ»¯×ÊԴʹÓ㬿ÉÒÔÌá¸ßϵͳµÄÐÔÄܺͿɿ¿ÐÔ¡£ÔÚÏÖʵӦÓÃÖУ¬ÐèҪƾ֤ÏêϸÐèÇóºÍϵͳ×ÊÔ´ÇéÐÎÀ´¾ÙÐе÷½âºÍÓÅ»¯£¬ÒÔµÖ´ï×î¼ÑЧ¹û¡£
ÒÔÉϾÍÊÇLinuxϵͳÀú³Ì×ÊÔ´ÏÞÖÆÓ¦¶ÔÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡