Sidecar on VM drop connections on large number of them

We installed sidecar on a virtual machine with MySQL. Our architecture requires a large number of connections to the database (up to 10,000)
But when we reach 1700-2000 connections, we can no longer connect and get errors like this

2023-11-03T10:23:44.119694Z	critical	envoy backtrace external/envoy/source/server/backtrace.h:104	Caught Aborted, suspect faulting address 0x3dd000368cc	thread=223451
2023-11-03T10:23:44.119762Z	critical	envoy backtrace external/envoy/source/server/backtrace.h:91	Backtrace (use tools/stack_decode.py to get line numbers):	thread=223451
2023-11-03T10:23:44.119802Z	critical	envoy backtrace external/envoy/source/server/backtrace.h:92	Envoy version: a1ff538a63890e27dd2add4b2680ba8dc49293ca/1.27.1-dev/Clean/RELEASE/BoringSSL	thread=223451
2023-11-03T10:23:44.119551Z	critical	envoy assert external/envoy/source/common/network/socket_interface_impl.cc:72	assert failure: SOCKET_VALID(result.return_value_). Details: socket(2) failed, got error: Too many open filesthread=223446

ulimit -n
40000