1 2 3 4 5 6 7 | vzctl set 115 --numtcpsock 8000 vzctl set 115 --numproc 8000 vzctl set 115 --kmemsize 1073741824:1181116006 vzctl set 115 --oomguarpages 128000000:9223372036854775807 |
where 115 is ID openvz container
it will give python start and work with thousands of threads and solve “Can’t start new thread” and “segmentation fault” errors
Full sh-script with network settings:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | vzctl start 115 ifconfig veth115.0 0 echo 1 > /proc/sys/net/ipv4/conf/veth115.0/forwarding echo 1 > /proc/sys/net/ipv4/conf/veth115.0/proxy_arp vzctl exec 115 "/sbin/ifconfig eth0 0" vzctl exec 115 "/sbin/ip addr add 192.168.1.115 dev eth0" vzctl exec 115 "/sbin/ip route add default dev eth0" vzctl exec 115 "service ssh start" vzctl exec 115 "service apache2 start" vzctl exec 115 "service mysql start" ip route add 192.168.1.115 dev veth115.0 vzctl set 115 --numtcpsock 8000 --save vzctl set 115 --numproc 8000 --save vzctl set 115 --kmemsize 1073741824:1181116006 --save vzctl set 115 --oomguarpages 128000000:9223372036854775807 --save |