Tigase with 10MB RAM

Java is still known as the environment with high resources consumption and programs written in Java as being very slow. When I talk to some people or developers I hear that you need at least 10MB of memory just to start Java Virtual Machine and if you want to run non-trivial application you need hundreds of megs.

This is something which seems to be verifiable quite easily. Let's write a few lines of identical code in C, C++ and Java. Compile it, run and measure time and memory usage. Java stays way behind even if you measure just code execution and omit application startup time.

In my Tigase server development I run lots of tests to ensure not only that all functions work correctly but also to ensure good performance, to check the server limits on certain hardware and... to test resources consumption.

Below is a table with tests reports I've run for the Tigase server with only 10MB of memory assigned to JVM. This is a full server installation with all typical components: SM, c2s, Bosh, MUC, PubSub, StanzaReceiver, VHostManager and even one external protocol component (XEP-0114) for connecting transport or Yate server. All tests passed fine for all supported databases.

Tigase-4.0.2-b1256 with 10MB RAM
Derby Derby SP Derby SQL MySQL MySQL SP MySQL SQL PgSQL PgSQL SP PgSQL SQL
00:00:37 00:00:38 00:00:37 00:00:19 00:00:17 00:00:18 00:00:18 00:00:18 00:00:19

 

Obviously you can not expect high performance from such installation and you can not connect too many users but it is perfectly usable and functional. It seems to be an ideal solution for small installations if there are just a few people using it for local communication. It can be put on old machine laying around or can be used as an embedded XMPP server for routers or other small devices.

An interesting conclusion from this test is that while Java seems to be slow and use lot's of resources for trivial applications it might be quite opposite for a big and complex programs. I think it is actually easier to implement high performance complex software in Java than it is in C. And I say this as a developer with 8 years of experience at programming in C and ASM on Linux. You have just to count every single bit while programming in Java as you would do this while programming in C or Assembler.

 

Follow us on:

Twitter

 
Back to Top