{"id":15645313,"url":"https://github.com/genaker/fastfpc","last_synced_at":"2025-04-05T20:03:31.049Z","repository":{"id":56723484,"uuid":"367127352","full_name":"Genaker/FastFPC","owner":"Genaker","description":"Magento 2 improved FPC and Varnish replacement was used for Magento SaaS solution when you need high performace and scaling. No more outdated Adobes official Varnish approach is requred","archived":false,"fork":false,"pushed_at":"2025-02-26T05:57:51.000Z","size":110,"stargazers_count":62,"open_issues_count":5,"forks_count":16,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T00:31:23.251Z","etag":null,"topics":["adobe","ecommerce","magento","varnish","varnish-cache"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Genaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-13T17:39:53.000Z","updated_at":"2025-03-22T12:50:24.000Z","dependencies_parsed_at":"2024-02-21T17:28:56.875Z","dependency_job_id":"a46edd51-028a-4d34-817f-a5ce4935a8e0","html_url":"https://github.com/Genaker/FastFPC","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.024390243902439046","last_synced_commit":"0d36a5ebbaa76498c1244d24d286315962b64e63"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genaker%2FFastFPC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genaker%2FFastFPC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genaker%2FFastFPC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genaker%2FFastFPC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Genaker","download_url":"https://codeload.github.com/Genaker/FastFPC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393552,"owners_count":20931811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adobe","ecommerce","magento","varnish","varnish-cache"],"created_at":"2024-10-03T12:06:17.125Z","updated_at":"2025-04-05T20:03:31.012Z","avatar_url":"https://github.com/Genaker.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastFPC\nthis extension requires Redis Magento Builtin cache enabled and  php_redis php extension installed.\nThe **phpredis** extension provides a native PHP API for communicating with the Redis key-value store. \n\n*Tested With: 2.4.7 Magento version*\n```\n#RHEL / CentOS\n#Installation of the php-pecl-redis package, from the EPEL repository:\n\nyum install php-pecl-redis\n```\n## Cloud Flare CDN FPC Cache Microservice Layer \n\nWorks great together with this Cloud Flare Worker FPC cache Layer:\nhttps://github.com/Genaker/CloudFlare_FPC_Worker\n\n\n## The Idea behind this Magento 2 FPC performance extension \n\nWhen I developed a Shopware 6-based website I noticed fast sub 1ms performance of the FPC cache. I checked the code and it amazed me. It is simple and made a right PHP  way! You don't need Varnish to run your FPC cache fast. You need just fast code without reusing the Magento 2 junk core framework.\n\n## Installation \n\nNginx \n\n```\nfastcgi_param PHP_VALUE \"auto_prepend_file=/var/www/html/magento/app/code/Mage/FPC/FPC.php\";\n```\n/var/www/html/magento/app/ shuld be changet to your magento path \n\nor \n\nadd it as a first line to app/bootstrap.php or pub/index.php\n\nAlso if you are using composer to install this stuff your path will be something like : ../vendor/mage/fpc/src/Mage/FPC.php\n\nInstallation into the app folder is preferable.  It is not a useless library. It is a part of your business to keep your site FAST. \n\n```\nrequire \"../app/code/Mage/FPC.php\";\n```\n\nAlso, this extension will work without this additional interaction (just install and forget) but it will be slower because it will load all Magento 2 via autoloader.\n\nor do next:\n\n```\ncomposer require mage/fpc\nbin/magento setup:upgrade\nbin/magento fpc:deploy\n```\n\n# Performance\n\nFPC generation time is 0.000481128 second.\n\n# Test \n\nTest Magento Headers: \n\n\u003cimg width=\"675\" alt=\"image\" src=\"https://github.com/user-attachments/assets/52656300-096c-4e9c-8900-1f5bd9b1c882\" /\u003e\n\u003c/br\u003e\nIn this case, we need install php-redis extension:\n```\nsudo apt-get install php-redis \n```\n\n# NodeJS implementation\n\n```\nnpm install ioredis node-cache dotenv\nor nmp install\nnode FPC.js\n```\nReplace Nginx:\n```\nlocation / {\n    try_files $uri $uri/ /index.php$is_args$args;\n}\n```\nWith:\n```\n# Try Node.js first, fallback to static files, then PHP\nlocation / {\n    # Try serving from Node.js first\n    proxy_pass http://127.0.0.1:3001;\n    proxy_set_header Host $host;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\n    # If Node.js fails, fallback to static files and then PHP\n    error_page 406 502 504 = @fallback;\n}\n\n# Fallback to Static Files or PHP if Node.js Fails\nlocation @fallback {\n    try_files $uri $uri/ /index.php$is_args$args;\n}\n```\n\n# Understanding Stale-While-Revalidate\nThe stale-while-revalidate caching strategy is designed to minimize latency by serving cached content immediately, even if it’s slightly outdated, while simultaneously updating the cache with fresh data in the background. This approach ensures that users receive a quick response and the cache remains up-to-date without blocking the main request flow.\n\n# Performance Test : \n```\nFPC-TIME:0.88ms\nFPC-TIME:0.99ms\nFPC-TIME:0.79ms\nFPC-TIME:0.98ms\nFPC-TIME:1.51ms\nFPC-TIME:1.08ms\nFPC-TIME:0.98ms\n```\nWith in-memory cache: \n```\nFPC-TIME:0.25ms\nFPC-TIME:0.22ms\nFPC-TIME:0.23ms\nFPC-TIME:0.62ms\nFPC-TIME:0.24ms\nFPC-TIME:0.46ms\nFPC-TIME:0.42ms\nFPC-TIME:0.29ms\nFPC-TIME:0.28ms\nFPC-TIME:/-\u003e0.14ms\nFPC-TIME:/-\u003e0.15ms\nFPC-TIME:/-\u003e0.14ms\nFPC-TIME:/-\u003e0.15ms\nFPC-TIME:0.25ms\nFPC-TIME:0.22ms\nFPC-TIME:0.20ms\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenaker%2Ffastfpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenaker%2Ffastfpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenaker%2Ffastfpc/lists"}