I created a simple setup to measure swooles I/O capacities: https://github.com/tux-rampage/swoole-io-test
During the tests I found out Swoole is always rejecting Requests larger than 2MB with the status code 413.
I guess this is related to #2373 (Which was a case I wanted to test in terms of memory consumption).
What did you do? If possible, provide a simple script for reproducing the error.
What did you expect to see?
What did you see instead?
413 Request entity too largeWhat version of Swoole are you using (show your php --ri swoole)?
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.4.16
Built => Feb 21 2020 09:46:05
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1d 10 Sep 2019
http2 => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
What is your machine environment used (including version of kernel & php & gcc) ?
You can set the package_max_length option to increase the maximum length limit. But this takes more memory, because Swoole-HTTP-Server keeps all requested data in memory, not disk.
$http = new Swoole\Http\Server("127.0.0.1", 9501);
$http->set([
'package_max_length' => 16 * 1024 * 1024,
])
Most helpful comment
You can set the package_max_length option to increase the maximum length limit. But this takes more memory, because Swoole-HTTP-Server keeps all requested data in memory, not disk.