{"id":18763,"date":"2020-02-26T10:46:27","date_gmt":"2020-02-26T15:46:27","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=18763"},"modified":"2024-09-16T08:04:38","modified_gmt":"2024-09-16T12:04:38","slug":"choosing-an-opcode-caching-method-with-w3-total-cache","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/w3-total-cache\/choosing-an-opcode-caching-method-with-w3-total-cache\/","title":{"rendered":"Choosing an Opcode Caching Method with W3 Total Cache"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><div class=\"boldgrid-section\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<p class=\"\"><span style=\"font-weight: 400;\"><strong>Opcode caching<\/strong> is a performance optimization technique that helps your website run faster by storing the &ldquo;prepared&rdquo; version of your PHP code in memory. In this guide we&rsquo;ll learn exactly how Opcode Caching works and how to leverage the pro feature to enhance WordPress performance with W3 Total Cache.&nbsp;<\/span><\/p>\n<h2 class=\"\" id=\"how-opcode-caching-works\">How Opcode Caching Works<\/h2>\n<h3 class=\"\" id=\"what-happens-normally\">What Happens Normally:<\/h3>\n<ul class=\"\">\n<li><span style=\"font-weight: 400;\"><strong>PHP Code Execution:<\/strong> WordPress is built with PHP, which is a programming language. Normally, when someone visits your WordPress site, the server reads your PHP code line by line, compiles it (turns it into a format the server can understand called <strong>bytecode<\/strong>), and then runs it to generate the web pages.<\/span><\/li>\n<li><b>Recompilation<\/b><span style=\"font-weight: 400;\">: Without opcode caching, every time someone visits your site, the server repeats this process&mdash;reads, compiles, and executes the PHP code. This can slow things down, especially if many people are visiting at once because the server is doing the same work repeatedly.<\/span><\/li>\n<\/ul>\n<h3 id=\"how-opcode-caching-helps\">How Opcode Caching Helps:<\/h3>\n<ul class=\"\">\n<li><b>Precompilation<\/b><span style=\"font-weight: 400;\">: Opcode caching takes the PHP code, compiles it into bytecode once, and stores this compiled version in the server&rsquo;s memory.<\/span><\/li>\n<li><b>Reusing Compiled Code<\/b><span style=\"font-weight: 400;\">: When the same PHP script is requested again (for example, when another visitor comes to your site), the server doesn&rsquo;t need to recompile it. Instead, it just uses the already compiled bytecode from memory, skipping the repetitive steps.<\/span><\/li>\n<li><b>Speed Boost<\/b>: Since the server can skip the time-consuming compilation step, it can serve pages much faster. This means your WordPress site loads quicker, which is great for user experience and can even improve your SEO rankings.<\/li>\n<\/ul>\n<h3 id=\"how-opcode-caching-specifically-enhances-wordpress-performance\">How Opcode Caching Specifically Enhances WordPress Performance:<\/h3>\n<ul class=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Reduced Server Load<\/b><span style=\"font-weight: 400;\">: WordPress relies heavily on PHP, so opcode caching can significantly reduce the workload on your server.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Faster Page Loads<\/b><span style=\"font-weight: 400;\">: By using cached bytecode, the server delivers pages faster because it&rsquo;s not wasting time recompiling the same code over and over.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Better Performance During High Traffic<\/b>: Opcode caching is particularly beneficial when your site experiences high traffic because it allows the server to handle more requests efficiently.<\/li>\n<\/ul>\n<h2 class=\"\" id=\"using-opcode-caching-with-w3-total-cache\">Using Opcode Caching with W3 Total Cache<\/h2>\n<p class=\"\">&nbsp;It is always a good idea to have <b>Opcode Caching<\/b> enabled as this functionality cannot be disabled, though when enabled it will report the actual state and (in the Pro version) statistics.<\/p>\n<p class=\"\">In production environments, you may have slightly better performance by disabling the &ldquo;Validate timestamps&rdquo; option under General Settings &gt; Opcode Cache. If you are using PHP-FPM, you may not be able to disable this in W3 Total Cache.<\/p>\n<p class=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18766\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps.jpg\" alt=\"\" width=\"652\" height=\"247\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps.jpg 652w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps-300x114.jpg 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps-610x231.jpg 610w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps-250x95.jpg 250w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps-550x208.jpg 550w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/18763-disable-validate-timestamps-475x180.jpg 475w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/p>\n<p class=\"\">When this option is disabled, files will not be recompiled on PHP file updates, such as when the file modification time changes, and will only be recompiled on PHP restart.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"boldgrid-section\" style=\"margin-top: 60px;\">\n<div class=\"container w3tc-radius\" style=\"border-width: 0px; background-image: url('https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png'); background-size: cover; background-position: 50% 5%;\" data-image-url=\"https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png\">\n<div class=\"row upsell-column\" style=\"padding-top: 2em; padding-bottom: 2em; color: #ffffff;\">\n<div class=\"col-lg-1 col-md-1 col-sm-12 col-xs-12 hidden-sm\">&nbsp;<\/div>\n<div class=\"col-lg-5 col-md-6 col-xs-12 col-sm-7\">\n<p class=\"h3\" style=\"color: #ffffff; line-height: 40px; margin-top: 0;\"><strong>Speed Up Your WordPress Website.<\/strong><\/p>\n<p class=\"h4\" style=\"color: #ffffff;\">A Difference of Just 100ms in Page Load Speeds Can Cause a Visitor to Prefer Your Competitor&rsquo;s Website.<\/p>\n<\/div>\n<div class=\"col-lg-6 col-md-5 col-sm-5 col-xs-12 text-center align-column-center\">\n<p class=\"\" style=\"border-width: 0px;\"><a class=\"button-w3tc-white\" style=\"border: 2px solid #30BEC4; font-size: 18px; padding: 15px 30px;\" href=\"https:\/\/www.boldgrid.com\/w3-total-cache\/#pricing\">View Plans<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"boldgrid-section\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<h2 class=\"\" id=\"choosing-a-method\">Choosing a Method<\/h2>\n<p class=\"\">PHP 5.5.0 or later comes with <b>Zend Opcache<\/b>, which is considered to have deprecated alternatives such as APC \/ APCu due to its much better performance. Because <b>Zend Opcache<\/b> is included with modern versions of PHP, it is already present and active, meaning that enabling <b>Opcode Caching<\/b> with <b>Zend Opcache<\/b> as the selected method will enable tracking and reporting statistics<\/p>\n<h3 id=\"zend-opcache-generally-recommended\">Zend Opcache (Generally Recommended)<\/h3>\n<p><b>Zend Opcache<\/b> is the Opcode caching implementation included with PHP 5.5.0 and later. Its performance is generally considered to be much faster and more efficient than APC-based Opcode caching.<\/p>\n<h3 id=\"alternative-php-cache-apc\">Alternative PHP Cache (APC)<\/h3>\n<p class=\"\"><b>APC<\/b> refers to <b>Alternative PHP Cache<\/b> which provides in-memory Opcode caching and a key-value store for looking up cached items. This is largely deprecated in favor of modern <a href=\"https:\/\/docs.google.com\/document\/d\/1QG6njMCSba-3CGBl-TT9ZuALFPmjGYKDKZH460btdZk\/edit#heading=h.w9av2y9sv7nz\">Opcode Caching<\/a> mechanisms, as <b>APC<\/b> is not supported in the PHP 7.x branch.<\/p>\n<p>APC is not stable when a lot of memory allocated. In cases where you are caching a small amount of data, <b>APC<\/b> may be the ideal method for single-instance hosting platforms such as VPS or Dedicated hosting.<\/p>\n<h3 id=\"caveats\">Caveats<\/h3>\n<p><b>APC<\/b> allows a userland-shared memory cache which may be ideal for multi-tenant scenarios, though this functionality is also available in <b>APCu<\/b> which is compatible with the PHP 7.x release branch.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Opcode caching is a performance optimization technique that helps your website run faster by storing the &ldquo;prepared&rdquo; version of your PHP code in memory. In this guide we&rsquo;ll learn exactly how Opcode Caching works and how to leverage the pro feature to enhance WordPress performance with W3 Total Cache.&nbsp; How Opcode Caching Works What Happens [&hellip;]<\/p>\n","protected":false},"author":529,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"","bgseo_description":"","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[742,692],"tags":[],"class_list":["post-18763","post","type-post","status-publish","format-standard","hentry","category-opcode-cache","category-w3-total-cache"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/529"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=18763"}],"version-history":[{"count":10,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18763\/revisions"}],"predecessor-version":[{"id":144161,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18763\/revisions\/144161"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=18763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=18763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=18763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}