[kwlug-disc] fun: 10k to a million threads and more?

Chris Frey cdfrey at foursquare.net
Tue May 30 16:03:00 EDT 2023


On Tue, May 30, 2023 at 01:01:59PM -0400, Khalid Baheyeldin wrote:
> According to this article, which seems to explore the same
> limits as you are trying, ulimit -s should be much larger
> than 256
> 
> https://www.baeldung.com/linux/max-threads-per-process
> 
> It also gives a formula that may help.

Thanks Khalid!  I had run across that page in my travels.  The default
stack size limit on my system was 8192 already.  My guess is that
a smaller stack would allow for more threads.

After reading the article, I started probing systemd a little more
closely.  I suspect my odd "9000ish" limit comes from my user slice:

	systemctl show user-1000.slice | grep TasksMax

This gives me 9933.

Logging in as root from the console gives me 65999:

	systemctl show user-0.slice | grep Tasks Max

With all the other changes I'd already done, this does indeed let me
create 60000 threads on my little 4G laptop.

- Chris




More information about the kwlug-disc mailing list