B4J Tutorial Raspberry Pi 2 - Server Performance


Staff member
Licensed User
I ran some tests to check whether the Raspberry Pi 2 can be suitable for server solutions.

The tests were similar to the tests previously done on a PC: http://www.b4x.com/android/forum/threads/server-performance-measures.37502/#content

The database used in the tests is a SQLite database. As explained here the journal mode should be set to wal: [WebApp] Concurrent access to SQLite databases

Note that you need to use sqlite-jdbc- The journal mode will not be set successfully with the version that currently included with B4J (3.7.2).
You can download it here: https://bitbucket.org/xerial/sqlite-jdbc/downloads
You can use the code I posted here to check the journal mode: http://www.b4x.com/android/forum/th...-files-wal-shm-not-created.47559/#post-364131

The results are:
  • Simple handler that writes some text as the response: >600 requests per second.
  • Handler that reads a random record from the database (based on the primary key): >600 rps.
  • Same handler in single threaded mode: 400 rps.
  • Handler that inserts a record in 10% of the requests (and reads a record in the other requests): 300 rps.
  • Same as the above with 50% inserts: 100 rps.
  • 100% inserts: 50 rps.
Based on these results a Raspberry Pi 2 can be a good option for a powerful (and low cost) back-end solution.