当前位置:Gxlcms >
PHP教程 >
PHP涓璭Accelerator銆乵emcached銆亁cache銆丄PC四涓姞閫熴?佺紦瀛樻墿灞曠殑鍖哄埆
PHP涓璭Accelerator銆乵emcached銆亁cache銆丄PC四涓姞閫熴?佺紦瀛樻墿灞曠殑鍖哄埆
时间:2021-07-01 10:21:17
帮助过:4人阅读
PHP涓璭Accelerator銆乵emcached銆亁cache銆丄PC 4涓姞閫熴?佺紦瀛樻墿灞曠殑鍖哄埆
杩欑瘒鏂囩珷涓昏浠嬬粛浜哖HP涓璭Accelerator銆乵emcached銆亁cache銆丄PC绛?涓姞閫熴?佺紦瀛樻墿灞曠殑鍖哄埆鍜岄?夌敤寤鸿,闇?瑕佺殑鏈嬪弸鍙互鍙傝?冧笅
銆?銆?鎶樿吘VPS鐨勬湅鍙嬶紝鍦ㄥ畨瑁呭ソLNMP绛塛eb杩愯鐜鍚庨兘浼氶?夋嫨涓?浜涚紦瀛樻墿灞曞畨瑁呬互鎻愰珮PHP杩愯閫熷害锛屽父琚汉浠嬬粛鐨勬湁 eAccelerator銆乵emcached銆亁cache銆丄lternative PHP Cache杩欏嚑涓紦瀛樻墿灞曪紝瀹冧滑涔嬮棿鏈変粈涔堝尯鍒?鍒嗗埆鐨勪綔鐢ㄥ張鏄粈涔?鎴戜滑濡備綍閫夋嫨?杩欐槸鏈枃缁欎簬澶у鐨勭瓟妗堛??
銆?銆?1銆乪Accelerator
銆?銆?eAccelerator鏄竴涓嚜鐢卞紑鏀炬簮鐮丳HP鍔犻?熷櫒锛屼紭鍖栧拰鍔ㄦ?佸唴瀹圭紦瀛橈紝鎻愰珮浜哖HP鑴氭湰鐨勭紦瀛樻?ц兘锛屼娇寰桺HP鑴氭湰鍦ㄧ紪璇戠殑鐘舵?佷笅锛屽鏈嶅姟鍣ㄧ殑寮?閿?鍑犱箮瀹屽叏娑堥櫎銆?瀹冭繕鏈夊鑴氭湰璧蜂紭鍖栦綔鐢紝浠ュ姞蹇叾鎵ц鏁堢巼銆備娇PHP绋嬪簭浠g爜鎵ф晥鐜囪兘鎻愰珮1-10鍊嶃?備粠鏂囧瓧涓婂彲浠ョ悊瑙d负锛歟Accelerator鏄疨HP鍔犻?熷櫒鎵╁睍銆?
銆?銆?2銆乵emcached
銆?銆?Memcached 鏄竴涓珮鎬ц兘鐨勫垎甯冨紡鍐呭瓨瀵硅薄缂撳瓨绯荤粺锛岀敤浜庡姩鎬乄eb搴旂敤浠ュ噺杞绘暟鎹簱璐熻浇銆傚畠閫氳繃鍦ㄥ唴瀛樹腑缂撳瓨鏁版嵁鍜屽璞℃潵鍑忓皯璇诲彇鏁版嵁搴撶殑娆℃暟锛屼粠鑰屾彁渚涘姩鎬併?佹暟鎹簱椹卞姩缃戠珯鐨勯?熷害銆備粠鏂囧瓧涓婂彲浠ョ悊瑙d负锛氬唴瀛樼紦瀛樻墿灞曪紝骞朵笖閽堝浜庨泦缇ゆ湇鍔″櫒浣跨敤杈冨锛屼富瑕佺敤浜庡垎甯冨紡缂撳瓨锛岀畻鏄暟鎹簱缂撳瓨銆?
銆?銆?3銆丄lternative PHP Cache(APC缂撳瓨)
銆?銆?Alternative PHP Cache (APC缂撳瓨)鏄竴绉嶅PHP鏈夋晥鐨勫紑鏀炬簮楂橀?熺紦鍐插偍瀛樺櫒宸ュ叿锛屼粬鑳藉缂撳瓨Opcode(鐩爣鏂囦欢)鐨凱HP涓棿鐮併??APC鐨勭紦瀛樺垎涓ら儴鍒?绯荤粺缂撳瓨鍜岀敤鎴锋暟鎹紦瀛? 绯荤粺缂撳瓨 鏄嚜鍔ㄤ娇鐢ㄧ殑,鏄寚APC鎶奝HP鏂囦欢婧愮爜鐨勭紪璇戠粨鏋滅紦瀛樿捣鏉?鐒跺悗鍦ㄥ啀娆¤皟鐢ㄦ椂鍏堝姣旀椂闂存爣璁般?傚鏋滄湭杩囨湡,鍒欎娇鐢ㄧ紦瀛樹唬鐮佽繍琛屻?傞粯璁ょ紦瀛?3600s(涓?灏忔椂).浣嗘槸杩欐牱浠嶄細娴垂澶ч噺CPU鏃堕棿.鍥犳鍙互鍦╬hp.ini涓缃畇ystem缂撳瓨涓烘案涓嶈繃鏈?apc.ttl=0).涓嶈繃濡傛灉杩欐牱璁剧疆,鏀硅繍PHP浠g爜鍚庨渶瑕乺estart涓?涓嬫偍鐨剋eb鏈嶅姟鍣?姣斿apache鈥?.鐩墠瀵笰PC鐨勬?ц兘娴嬭瘯涓?鑸寚鐨勬槸杩欎竴灞俢ache;浠庢枃瀛椾笂鐞嗗埌锛欰lternative PHP Cache(APC缂撳瓨)涔熺畻鏄竴绉嶅唴瀛樼紦瀛樻墿灞曪紝绠楁槸鏁版嵁搴撶紦瀛樻墿灞曘??
銆?銆?4銆乆cache
銆?銆?鏄竴涓紑婧愮殑opcode缂撳瓨鍣?浼樺寲鍣? 浠栬兘澶熸彁楂樻湇鍔″櫒涓婄殑PHP鎬ц兘锛屼粬閫氳繃鎶婄紪璇慞HP鍚庣殑鏁版嵁缂撳啿鍒板叡浜唴瀛樹粠鑰岄伩鍏嶉噸澶嶇殑缂栬瘧杩囩▼, 鑳藉鐩存帴浣跨敤缂撳啿鍖哄凡缂栬瘧鐨勪唬鐮佷粠鑰屾彁楂橀?熷害. 閫氬父鑳藉鎻愰珮鎮ㄧ殑椤甸潰鐢熸垚閫熺巼2鍒?鍊? 闄嶄綆鏈嶅姟鍣ㄨ礋杞姐??鍏跺疄瀹冧笌eAccelerator涓?鏍锋槸PHP鍔犻?熷櫒鎵╁睍銆?
銆?銆?浠ヤ笂灏辨槸浠栦滑鐨勪綔鐢ㄤ笌鍖哄埆锛岀畝鍗曚竴鐐瑰氨鏄細eAccelerator,xcache鏄疨HP缂撳瓨鎵╁睍锛宮emcached銆丄PC缂撳瓨鏄暟鎹簱缂撳瓨鎵╁睍锛屼竴鑸袱鑰呭彧鏈夎瀹夎鍏朵腑涓?涓嵆鍙紝涓嶈璐銆傚彟澶栵紝瀹為檯娴嬭瘯涓彂鐜板綋Cache鏁伴噺瓒呰繃涓?瀹氶榾鍊肩殑鏃跺?欙紝APC鐨勬?ц兘涓嶅Memcache銆傛墍浠ュ湪鎵╁睍鐨勯?夋嫨涓婏紝鏈汉涓?鑸細閫夋嫨xcache+memcached杩欎釜缁勫悎銆?