How Fast are Laravel-based Web Applications?
As a rule, caching is the way to increase application performance by storing in the filesystem or in memory results of such expensive operations as requests to the database server.
The most common way of explaining the power of cache is via analogy.
“Caching is like storing milk in the home refrigerator, so you don't have to go to the store (or the farm) every time you need it” (CEO of Brightidea, San Francisco Bay Area, the USA).
Laravel PHP Framework provides wonderful built-in tool to keep the Laravel applications fast – so called cache drivers.
How does caching work in Laravel?
After customers enter an URL of your application into browser, the physical server, where your application is hosted, will receive a request, process it (in a lot of cases, by making requests to the database server), and send back a response. A large number of complex requests to the database server is one of the most resource-intensive operations.
Imagine that 1,000+ Internet users visit your website simultaneously and make requests to the database server! You should have very expensive equipment to handle them all as fast as possible. It’s much more efficient to transfer the most requested pages once, cache them and then serve future requests directly from the cache.
Laravel supports popular cache backends like Memcached and Redis out of the box. By default, Laravel is configured to use the file cache driver, which stores cached objects in the filesystem. For larger applications, it is better to use an in-memory cache such as Memcached or APC. However, with Laravel it is even possible to configure multiple cache configurations for the same driver.
Milan Lesichkov: «I have moved several slow WordPress sites to Laravel. Speed improvement is about 700%. 10s (WordPress) - 1.5 s. (Laravel)».
How much faster can caching make Laravel applications?
Image source: scotch.io/tutorials/caching-in-laravel-with-speed-comparisons
The performance can be improved twice just by using cache! Awesome enough, right? Besides this, our developers know that there are some other technics to boost speed of the php-based application.
Check out also this package to optimize your site automatically which results on a 35%+ optimization.
- Inlines small external CSS files;
- Removes unnecessary attributes in HTML tags;
- Injects tags in the HEAD to enable the browser to do DNS prefetching;
- Removes unnecessary quotes in HTML tags;
- Removes unnecessary prefixes from URLs;
- Removes unnecessary whitespace in HTML;
- Removes HTML comments.
Also, see our Laravel tutorial for beginners.