I setup Glassfish 4 websever using websocket.
When I connect to Glassfish through webscoket, I use VisualVM monitor it and see the live threads are increased when Glassfish get new connection. This number is also bigger, sometimes it decrease small amount (mayge GC perform) and turn increase larger amount.
If my server get 1000 new connections over Websocket per minutes and 1000 new live thread appear, so my server will get trouble after 2 hours.
I simulated about 30000 threads to test my server. It's ok. But if over 30000 threads, it will appear errors message: Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread.
JVM options: -Xmx:10240m -Xms:10240m
How to interrupt Glassfish Websocket new live thread to prevent trouble to server?