Author Topic: Run worklet single-threaded  (Read 7534 times)

fjo

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Run worklet single-threaded
« on: April 08, 2015, 11:57:52 AM »
Hello.

Is there a config option to run a worklet only in a single thread and not on multiple threads concurrently?

Thanks for your help!

JeremyArnold

  • Moderator
  • Newbie
  • *****
  • Posts: 15
  • Karma: +1/-0
Re: Run worklet single-threaded
« Reply #1 on: April 15, 2015, 11:41:52 AM »
You should be able to do this by adding a setting to your <worklet> settings in config.xml.  Add the following setting:
  <num-transaction-threads>1</num-transaction-threads>

The JVM will still have multiple threads (for garbage collection, JIT, etc.), but Chauffeur will only run transactions in a single thread in each Client JVM.

In many cases you'll also want to set:
  <max-per-client-users>1</max-per-client-users>

This will limit the number of Users (which are often used to hold per-user session data).  Chauffeur will ensure that any user will only have one active transaction at any given time, so either one of these settings will generally work.  I almost always set them to the same value.