By fadlinco
Heya!
I’m running Apache2 on a CPU-Optimized 32 GB Memory + 4CPUs / 50 GB Disk + 300 GB / SGP1 - Ubuntu 20.04 (LTS) x64. The time-to-first-byte is between 700-790ms and im running my Magento2 Website that contain more then 50k Products.
I’d like to get that down to 100ms, maybe 200ms. Is that a good goal… How do I get that number down without using Varnish? or Varnish must required…? also i try to install varnish its not proper install or work with apache2… Can I tweak Apache2 some way, or what i do…?
Thanks, Numan
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @fadlinco,
Improving TTFB is actually a two-way process. There is your optimization of your Droplet(Apache2,MySQL other service) and your Website (Caching, Optimazint images and so on). You can’t completely optimize one without the other.
Let’s start with your Droplet. First, I’ll recommend starting using some kind of server-based caching. A good solution is Opcache but honestly, Varnish is a lot better.
Now you mentioned you can;t configure/tweak Apache to work with Varnish. Usually, Varnish is used in front of Apache to cache requests which then as proxy to forward to Apache. With that in mind, you can opt in for Opcache and use that one instead. It should help!
The next step after the server-base caching is using PHP-FPM with your PHP. PHP-FPM will help speed up requests a lot just because of how it works.
Another thing I have in my mind is using the latest PHP version there is available.
And one last recommendation on optimizing your Droplet, is using an MPM_WORKER with your Apache2 installation if you are not already doing it. There are 3 mpm modules with Apache2. By default it uses mpm_prefork but this is an outdated mpm module so people tend to use mpm_worker or mpm_event. You can read more about them and then decide which to use but my recommendation is mpm_worker.
All these should help bring down the TTFB Droplet wise.
Regarding your Website, I’m not that familiar with Magento but there should be some plugins that help with caching your website and optimizing images.
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.