activej / activej

ActiveJ is an alternative Java platform built from the ground up. ActiveJ redefines core, web and high-load programming in Java, providing simplicity, maximum performance and scalability
https://activej.io
Apache License 2.0
880 stars 72 forks source link

How to increase no of worker threads. #213

Open walioul opened 2 years ago

walioul commented 2 years ago

How to increase the number of the thread pool from 4 to 8 when using MultithreadedHttpServerLauncher?

Thanks in advance.

eduard-vasinskyi commented 2 years ago

Hi, @walioul.

There are several options to change the number of workers in launcher:

  1. Add the file http-server.properties to the class path with property workers=8.
  2. Run the launcher with VM option -Dconfig.workers=8
  3. If you extend MultithreadedHttpServerLauncher, you can override the Launcher#getOverrideModule method and provide your own module with provided Config (similar to the MultithreadedHttpServerLauncher#config() method, but with the default number of workers set to 8).

Those predefined launchers that you can find in ActiveJ are for demonstration purposes. For production code, we recommend that you write your own launchers using predefined ones for reference.