In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "How to test Laravel Octane Beta". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Here's how to test Laravel Octane Beta!
Test machine configuration:
4 Cores 16gPHP 8.0.3Swoole 4.6.4
Testing web routing
Routing configuration:
//routes/web.phpRoute::get('/benchmark', function () { return ['foo' => 'bar'];});
Server startup command:
php artisan octane:start --server=swoole --port=9999 \-host=0.0.0.0 --max-requests=20000 --task-workers=2 \--workers=32 --quiet
Performance Test Tool Command:
wrk -d10 -c300 -t32 --timeout=15 \http://127.0.0.1:9999/benchmark
Test results:
Running 10s test @ http://127.0.0.1:9999/benchmark 32 threads and 300 connections Thread Stats Avg Stdev Max +/- Stdev Latency 568.28ms 249.82ms 1.34s 67.44% Req/Sec 9.51 10.69 148.00 93.08% 1846 requests in 10.11s, 1.86MB readRequests/sec: 182.67Transfer/sec: 188.74KB
Test conclusion:
The performance is very poor, and it may be because web routing uses session, and the default configuration is file session. Then I switched to api routing for testing.
Test Api routing (32 workers)
Routing Configuration:
//routes/api.phpRoute::get('/benchmark', function () { return ['foo' => 'bar'];});
Current limiting configuration:
protected $middlewareGroups = [... 'api' => [ ... //'throttle:api', ... ],...];
Server startup command:
php artisan octane:start --server=swoole --port=9999 \-host=0.0.0.0 --max-requests=20000 --task-workers=2 \--workers=32 --quiet
Performance Test Tool Command:
wrk -d10 -c300 -t32 --timeout=15 \http://127.0.0.1:9999/api/benchmark
Test results:
Running 10s test @ http://127.0.0.1:9999/api/benchmark 32 threads and 300 connections Thread Stats Avg Stdev Max +/- Stdev Latency 242.12ms 130.53ms 617.97ms 63.19% Req/Sec 41.43 24.41 390.00 71.86% 11712 requests in 10.11s, 2.67MB readRequests/sec: 1158.26Transfer/sec: 270.34KB
Test Api routing (64 workers)
Routing configuration:
//routes/api.phpRoute::get('/benchmark', function () { return ['foo' => 'bar'];});
Current limiting configuration:
protected $middlewareGroups = [... 'api' => [ ... //'throttle:api', ... ],...];
Server startup command:
php artisan octane:start --server=swoole --port=9999 \-host=0.0.0.0 --max-requests=20000 --task-workers=2 \--workers=64 --quiet
Performance Test Tool Command:
wrk -d10 -c300 -t32 --timeout=15 \http://127.0.0.1:9999/api/benchmark
Test results:
Running 10s test @ http://127.0.0.1:9999/api/benchmark 32 threads and 300 connections Thread Stats Avg Stdev Max +/- Stdev Latency 191.59ms 150.91ms 711.89ms 72.06% Req/Sec 71.80 46.26 450.00 56.46% 15971 requests in 10.10s, 3.64MB readRequests/sec: 1581.67Transfer/sec: 369.16KB
As can be seen from the results, there is no use of session api routing interface, performance has been greatly improved. After the number of server workers increases, the performance improvement is not obvious.
Due to time and resource constraints, the testing was not rigorous, and there was no test database operation or comparison with php-fpm schema. The interface and test tools run on the same ECS. Expect more authoritative and detailed third-party evaluations later.
At this point, I believe everyone has a deeper understanding of "how to test Laravel Octane Beta", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.