{"id":36225,"date":"2024-10-01T02:57:14","date_gmt":"2024-09-30T18:57:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/36225\/"},"modified":"2024-10-01T02:57:14","modified_gmt":"2024-09-30T18:57:14","slug":"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_socache_shmcb%e9%80%b2%e8%a1%8c%e6%9c%83%e8%a9%b1%e7%b7%a9%e5%ad%98","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/36225\/","title":{"rendered":"Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u6703\u8a71\u7de9\u5b58"},"content":{"rendered":"<h1 id=\"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_socache_shmcb%e9%80%b2%e8%a1%8c%e6%9c%83%e8%a9%b1%e7%b7%a9%e5%ad%98-UcAqszKjQj\">Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u6703\u8a71\u7de9\u5b58<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0c\u7db2\u7ad9\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\u662f\u6bcf\u500b\u7db2\u7ad9\u7ba1\u7406\u54e1\u5fc5\u9808\u91cd\u8996\u7684\u5169\u500b\u91cd\u8981\u65b9\u9762\u3002Apache\u4f5c\u70ba\u4e00\u500b\u5ee3\u6cdb\u4f7f\u7528\u7684\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u63d0\u4f9b\u4e86\u591a\u7a2e\u6a21\u7d44\u4f86\u589e\u5f37\u5176\u529f\u80fd\uff0c\u5176\u4e2d\u4e4b\u4e00\u5c31\u662fmod_socache_shmcb\u3002\u9019\u500b\u6a21\u7d44\u5c08\u9580\u7528\u65bc\u6703\u8a71\u7de9\u5b58\uff0c\u80fd\u5920\u6709\u6548\u63d0\u5347\u7db2\u7ad9\u7684\u6027\u80fd\uff0c\u540c\u6642\u589e\u5f37\u5b89\u5168\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afmod_socache_shmcb%ef%bc%9f-UcAqszKjQj\">\u4ec0\u9ebc\u662fmod_socache_shmcb\uff1f<\/h2>\n<p>mod_socache_shmcb\u662f\u4e00\u500bApache\u6a21\u7d44\uff0c\u4e3b\u8981\u7528\u65bc\u5728\u5171\u4eab\u5167\u5b58\u4e2d\u7de9\u5b58\u6703\u8a71\u6578\u64da\u3002\u9019\u7a2e\u7de9\u5b58\u65b9\u5f0f\u4e0d\u50c5\u80fd\u63d0\u9ad8\u6578\u64da\u7684\u8b80\u53d6\u901f\u5ea6\uff0c\u9084\u80fd\u6e1b\u5c11\u5c0d\u5f8c\u7aef\u6578\u64da\u5eab\u7684\u8acb\u6c42\uff0c\u5f9e\u800c\u964d\u4f4e\u4f3a\u670d\u5668\u7684\u8ca0\u64d4\u3002\u9019\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u80fd\u548c\u9ad8\u53ef\u7528\u6027\u7684\u7db2\u7ad9\u4f86\u8aaa\uff0c\u5c24\u5176\u91cd\u8981\u3002<\/p>\n<h2 id=\"mod_socache_shmcb%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86-UcAqszKjQj\">mod_socache_shmcb\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n<p>mod_socache_shmcb\u4f7f\u7528\u5171\u4eab\u5167\u5b58\u4f86\u5b58\u5132\u6703\u8a71\u6578\u64da\u3002\u7576\u7528\u6236\u8a2a\u554f\u7db2\u7ad9\u6642\uff0cApache\u6703\u5c07\u6703\u8a71\u6578\u64da\u5b58\u5132\u5728\u5171\u4eab\u5167\u5b58\u4e2d\uff0c\u4e26\u5728\u5f8c\u7e8c\u8acb\u6c42\u4e2d\u5feb\u901f\u6aa2\u7d22\u9019\u4e9b\u6578\u64da\u3002\u9019\u6a23\u7684\u8a2d\u8a08\u4f7f\u5f97\u6578\u64da\u7684\u8b80\u53d6\u901f\u5ea6\u5927\u5e45\u63d0\u5347\uff0c\u4e26\u4e14\u80fd\u5920\u652f\u6301\u591a\u500bApache\u9032\u7a0b\u540c\u6642\u8a2a\u554f\u9019\u4e9b\u6578\u64da\u3002<\/p>\n<h3 id=\"%e9%85%8d%e7%bd%aemod_socache_shmcb-UcAqszKjQj\">\u914d\u7f6emod_socache_shmcb<\/h3>\n<p>\u8981\u555f\u7528mod_socache_shmcb\uff0c\u9996\u5148\u9700\u8981\u78ba\u4fddApache\u5df2\u7d93\u5b89\u88dd\u4e86\u8a72\u6a21\u7d44\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5\uff1a<\/p>\n<pre><code>apachectl -M | grep socache_shmcb<\/code><\/pre>\n<p>\u5982\u679c\u6a21\u7d44\u5df2\u7d93\u555f\u7528\uff0c\u63a5\u4e0b\u4f86\u53ef\u4ee5\u5728Apache\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u9032\u884c\u8a2d\u7f6e\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u57fa\u672c\u7684\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre><code>LoadModule socache_shmcb_module modules\/mod_socache_shmcb.so\n\n# \u8a2d\u7f6e\u5171\u4eab\u5167\u5b58\u7684\u5927\u5c0f\nSocacheShmcbInit 10 1000000\n\n# \u8a2d\u7f6e\u6703\u8a71\u7de9\u5b58\u7684\u904e\u671f\u6642\u9593\nCacheSocache socache_shmcb\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c`SocacheShmcbInit`\u6307\u4ee4\u8a2d\u7f6e\u4e86\u5171\u4eab\u5167\u5b58\u7684\u5927\u5c0f\uff0c\u7b2c\u4e00\u500b\u53c3\u6578\u662f\u69fd\u7684\u6578\u91cf\uff0c\u7b2c\u4e8c\u500b\u53c3\u6578\u662f\u6bcf\u500b\u69fd\u7684\u5927\u5c0f\uff08\u4ee5\u5b57\u7bc0\u70ba\u55ae\u4f4d\uff09\u3002\u9019\u4e9b\u53c3\u6578\u53ef\u4ee5\u6839\u64da\u5be6\u969b\u9700\u6c42\u9032\u884c\u8abf\u6574\u3002<\/p>\n<h2 id=\"%e5%ae%89%e5%85%a8%e6%80%a7%e8%80%83%e9%87%8f-UcAqszKjQj\">\u5b89\u5168\u6027\u8003\u91cf<\/h2>\n<p>\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u6703\u8a71\u7de9\u5b58\u6642\uff0c\u5b89\u5168\u6027\u662f\u4e0d\u53ef\u5ffd\u8996\u7684\u56e0\u7d20\u3002\u7531\u65bc\u6703\u8a71\u6578\u64da\u5b58\u5132\u5728\u5167\u5b58\u4e2d\uff0c\u9019\u610f\u5473\u8457\u5982\u679c\u4f3a\u670d\u5668\u906d\u5230\u653b\u64ca\uff0c\u653b\u64ca\u8005\u53ef\u80fd\u6703\u7372\u53d6\u9019\u4e9b\u654f\u611f\u6578\u64da\u3002\u56e0\u6b64\uff0c\u5efa\u8b70\u63a1\u53d6\u4ee5\u4e0b\u63aa\u65bd\u4f86\u589e\u5f37\u5b89\u5168\u6027\uff1a<\/p>\n<ul>\n<li><strong>\u52a0\u5bc6\u6703\u8a71\u6578\u64da\uff1a<\/strong>\u5728\u5c07\u6578\u64da\u5b58\u5132\u5230\u5171\u4eab\u5167\u5b58\u4e4b\u524d\uff0c\u5c0d\u5176\u9032\u884c\u52a0\u5bc6\uff0c\u4ee5\u9632\u6b62\u672a\u7d93\u6388\u6b0a\u7684\u8a2a\u554f\u3002<\/li>\n<li><strong>\u5b9a\u671f\u6e05\u7406\u7de9\u5b58\uff1a<\/strong>\u8a2d\u7f6e\u5b9a\u671f\u6e05\u7406\u7de9\u5b58\u7684\u6a5f\u5236\uff0c\u4ee5\u6e1b\u5c11\u904e\u671f\u6578\u64da\u7684\u98a8\u96aa\u3002<\/li>\n<li><strong>\u9650\u5236\u8a2a\u554f\u6b0a\u9650\uff1a<\/strong>\u78ba\u4fdd\u53ea\u6709\u6388\u6b0a\u7684\u7528\u6236\u548c\u9032\u7a0b\u53ef\u4ee5\u8a2a\u554f\u5171\u4eab\u5167\u5b58\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-UcAqszKjQj\">\u7d50\u8ad6<\/h2>\n<p>mod_socache_shmcb\u662f\u4e00\u500b\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u7db2\u7ad9\u7ba1\u7406\u54e1\u63d0\u9ad8Apache\u4f3a\u670d\u5668\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002\u901a\u904e\u5408\u7406\u914d\u7f6e\u548c\u5b89\u5168\u63aa\u65bd\uff0c\u7db2\u7ad9\u53ef\u4ee5\u5728\u63d0\u4f9b\u5feb\u901f\u97ff\u61c9\u7684\u540c\u6642\uff0c\u4fdd\u8b77\u7528\u6236\u7684\u654f\u611f\u6578\u64da\u3002\u5c0d\u65bc\u5c0b\u6c42\u9ad8\u6548\u80fd\u548c\u5b89\u5168\u6027\u7684\u7db2\u7ad9\uff0c\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u6703\u8a71\u7de9\u5b58\u7121\u7591\u662f\u4e00\u500b\u660e\u667a\u7684\u9078\u64c7\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bcVPS\u6216\u5176\u4ed6\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\u611f\u8208\u8da3\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff1a<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u3001<a href=\"https:\/\/server.hk\">\u4e91\u670d\u52a1\u5668<\/a>\u7b49\u670d\u52d9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3Apache\u5b89\u5168\u7b56\u7565\uff0c\u4f7f\u7528mod_socache_shmcb\u9032\u884c\u9ad8\u6548\u6703\u8a71\u7de9\u5b58\uff0c\u63d0\u5347\u7db2\u7ad9\u6027\u80fd\u8207\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-36225","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=36225"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36225\/revisions"}],"predecessor-version":[{"id":36226,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36225\/revisions\/36226"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=36225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=36225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=36225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}