java - How to increase Jetty threadpool size with jetty-runner on Heroku? -


i have java (spring mvc) webapp running on heroku. uses setup described in article: getting started spring mvc hibernate on heroku

it looks jetty default uses 1 thread. given heroku & jetty-runner setup, what simplest way increase threadpool size?

nb: not have custom jetty related code (so it's unclear how i'd apply advice e.g. at: how use setthreadpool() in jetty). if possible, i'd prefer keep way. jetty-related in procfile , pom.xml (see below).

can set threadpool size jetty-runner parameter or config option? if need create jetty config file, how make heroku/jetty-runner use it?

procfile:

web: java $java_opts -jar target/dependency/jetty-runner.jar --port $port target/*.war 

pom.xml:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-dependency-plugin</artifactid>     <version>2.7</version>     <executions>         <execution>             <phase>package</phase>             <goals>                 <goal>copy</goal>             </goals>             <configuration>                 <artifactitems>                     <artifactitem>                         <groupid>org.mortbay.jetty</groupid>                         <artifactid>jetty-runner</artifactid>                         <version>8.1.10.v20130312</version>                         <destfilename>jetty-runner.jar</destfilename>                     </artifactitem>                 </artifactitems>             </configuration>         </execution>     </executions> </plugin> 

what solved me (a spring, not jetty issue)

i wrong when wrote in question:

it looks jetty default uses 1 thread.

this turned out purely spring issue. in applicationcontext.xml, changed

<task:annotation-driven/> 

into

<task:annotation-driven scheduler="scheduler-pool"/> <task:scheduler id="scheduler-pool" pool-size="5"/> 

... , different @scheduled tasks happily run in separate threads scheduler-pool-1 or scheduler-pool-3.

how tweak jetty threadpool configs (with jetty-runner)

(before realised problem not jetty issue, had looked how jetty threadpools configured. documenting here; maybe useful someone.)

create jetty.xml config file (somewhere src/main/resources gets copied compilation target dir), , customise liking.

example (probably poor one):

<?xml version="1.0"?>  <!-- reason, must use org.eclipse classes,   though depend on org.mortbay jetty... -->  <configure id="server" class="org.eclipse.jetty.server.server">      <set name="threadpool">         <new class="org.eclipse.jetty.util.thread.queuedthreadpool">             <set name="minthreads">3</set>             <set name="maxthreads">5</set>         </new>     </set>  </configure> 

then, tell jetty-runner use config file --config switch. example in heroku's procfile, add --config target/classes/jetty.xml:

web: java $java_opts -jar target/dependency/jetty-runner.jar --config target/classes/jetty.xml --port $port target/*.war  

if happen using jetty-maven-plugin, can tell use custom jetty config adding under <configuration> in pom.xml:

<jettyconfig>target/classes/jetty.xml</jettyconfig> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -