Laravel Octane v1.0 Released

The Laravel team is working Laravel Octane, a tool to improve the performance of your Laravel app. After releasing the beta in April, Octane released a stable version of !

Octane has some outstanding performance criteria using high-powered application servers integrated with Laravel. Some requirements to consider considering octane's determination and readiness:

  • Octane requires PHP v8.0+
  • Octane supports Roadrunner, an application server, load balancer, and operations manager written in Golang.
  • Supports Swoole PHP, a high-performance programmable server for PHP with Octane, Async IO, Coroutines and Fibers
  • Laravel Sail provides an easy way to start with both Roadrunner and Swoole

Read the documentation carefully when deciding which basic server you want to run. Both servers offer high performance, but Octane provides vendor-specific features for Swoole that are not possible in Roadrunner.

When using Swoole, you have access to an octane cache drive:

Cache::store('octane')->put('framework', 'Laravel', 30);

According to readme dosy,the Octane cache driver (supported by the Swoole table):

[Swoole] provides read and write speeds of up to 2 million transactions per second. This cache driver is supported by Swoole tables. All data stored in the cache is available to all employees on the server. However, the server will clear cached data during the restart.

You can also take advantage of Simultaneous Missions with Swoole; this means that you can execute operations at the same time through light background tasks:

use App\User;
use App\Server;
use Laravel\Octane\Facades\Octane;
[$users, $servers] = Octane::concurrently([
fn () => User::all(),
fn () => Server::all(),
]);

Finally, Swoole has the concept of Swoole tables that "provide excessive performance efficiency and the data in these tables can be accessed by all employees on the server".

Here's an example of how you can interact with Swoole tables using Octane:

Octane tables config in config/octane.php
return [
'tables' => [
'example:1000' => [
'name' => 'string:1000',
'votes' => 'int',
],
],
];
Usage example
use Laravel\Octane\Facades\Octane;
Octane::table('example')->set('uuid', [
'name' => 'Nuno Maduro',
'votes' => 1000,
]);
Octane::table('example')->get('uuid');

To learn more

  Quote

KARABAY A, 2021 . Laravel Octane v1.0 Published,

https://www.karabayyazilim.com/blog/php/framework/laravel/laravel-octane-v10-yayinlandi-2021-05-12-212603

(Accessed May 12, 2021).


  Share this post

Comments (0)

Comment

Subscribe
Sign up for the email newsletter to be the first to know about my blog posts