[codecasts/ambientum] Performance Improvements & Refactoring
Ambientum is an out of the box Docker solution for Laravel, Symfony and Node.js projects.
Repository:
https://github.com/codecasts/ambientum
Pull Request:
https://github.com/codecasts/ambientum/pull/99
New Features
This release brings optional performance improvements and refactoring on the Nginx templates.
Extreme/Aggressive OPCache Mode.
OPCache is a PHP extension which pre-compile scripts into bytecode and cache that bytecode in-memory, meaning the application does not need to load the entire source code from disk at every request.
For production applications running on Docker, a change on the source code is also a restart on the PHP-FPM handler, since the containers get removed and new ones are started, based on the newly built images.
Since OPCache will always be restarted along PHP-FPM when the code changes, it's safe to assume OPCache does not need to check for code changes on disk, since it's a pre-built Docker image.
The Extreme OPCache Mode on Ambientum is a feature, enabled by a environment variable, which sets sensitive values for the OPCache configuration, which enables OPCache to try loading all the source code into the bytecode cache.
This means that, once the first requests arrive after a deploy, the application is completely (or close-to) accessible from memory.
This technique was tested by on a custom build, before releasing as a feature. The performance improvements will vary across applications, but evidences have shown improvements between 20% to 300% faster response times.
Notice:
This feature should ONLY be enabled on production, since the extreme caching will render development changes on code only visible if the container gets restarted.
The extreme OPCache mode can be enabled by using the OPCACHE_MODE=extreme
environment variable.
Nginx Templates Refactoring.
Ambientum supports both Laravel and Symfony PHP frameworks (Lumen included).
While the PHP configuration for each framework is pretty much identical, the Nginx rules for each one are far from being the same.
The FRAMEWORK
environment variable can be used to enable a given Nginx template.
The currently possible values for FRAMEWORK
are:
FRAMEWORK=laravel
FRAMEWORK=symfony
FRAMEWORK=symfony-dev
The common parts for those templates were extracted into partials, to make the code easier to maintain.
Also, while refactoring, a new mode was introduced, the laravel-cache
framework mode, which automatically sets Nginx cache headers on media content (images, videos, fonts) and disable access logs for such assets.
Contributions
Contact on the Github repository, Discord or Commenting on the Post.
Temporary Utopian Disclaimer
Upon payout, rewards corresponding the beneficiary share will be transferred to utopian.pay
.
I am computer literate but docker applications I just use them I tend not to bother with how it works but is good to know you are into it and bringing good stuff to us! thanks!
Thank you for your contribution. Since you said "Ambientum is an out of the box Docker solution for Laravel, Symfony and Node.js projects.", I am not able to find the documentation of Node.js in the README, have I missed something?
Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.
[utopian-moderator]
Hey @hernandev
Thanks for contributing on Utopian.
We're already looking forward to your next contribution!
Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Desenvolver programas exige muito esforço e persistência. Parabéns!
projeto #ptgram power | faça parte | grupo steemit brasil
—-
conheça também meu projeto pessoal: BÍblia Blockchain
Well, I am a total newbie to programming. I love this stuff, though. Thanks for the post, man!
projeto #ptgram power
Hi bro. I hope to be as good as you are at programming one day. Thank you for sharing.
projeto #ptgram power | faça parte | grupo steemit brasil
Congratulations @hernandev! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP