Cpu and memory usage with AVChat 3 (text chat only mode), Red5 0.8 and a slow server
We’ve made a little test today with the latest version of AVChat (1059) which has some optimized media server file for Red5.

1) We’ve installed Red5 0.8 on an old Toshiba M70 laptop with these specs:
- Pentium M 1.7Ghz (FSB:400Mhz with 2Mb of 2nd level cache)
- 1G DDR2 RAM
- 60GB HDD @ 5400rpm
- 100Mbps Intel network card
- Ubuntu 10.04 LTS
which is connected to our LAN via wire.
2) Once Red5 was up and running on the laptop, we used an internal flash app named “AVChat Virtual User” to create load on the Red5 server! This app creates a lot of virtual users, once each user is created it connects to the avchat30 app on the media server. Once connected it starts generating the kind of load that a normal user would generate: sending text messages, changing status (idle, online), etc… . These virtual users are not able to stream/view video that’s why this quick test today covers AVChat 3 in text chat only mode.

We will release this app when we polsih it so that anyone can test their own servers!
3) With AVChat Virtual User we’ve gradually connected 550 users (100 -> 450 – >550) and observed the load on Red5.
To monitor Red5 we’ve used several tools:
- Java VisualVM: http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html
- top command on the laptop running Ubuntu/Red5 : http://manpages.ubuntu.com/manpages/lucid/man1/top.1.html
- Ubuntu System Monitor
4) The results: CPU usage

5) The results: Memory consumption

6) Conclusion:
- a user connecting generates more CPU usage than a user that is already connected
- Red5/AVChat 3 uses about 6-7Mb of RAM for each 100 users (in addition to the memory used by Red5 by default)
- the cheapest VPS servers (256Mb of RAM) can hold a few hundred users online!
- this server would hold 1000 users (in text chat mode) before reaching 80-90% CPU usage!
- in a real world scenario you would not have the peak CPU usage caused by connecting 100 very ast ( AVChat Virtual User app connecs 1 user every second )
This is by no means an attempt to squeeze as much performance as we can out of this server! There are many ways one cand do that first being the choice of OS.
Note: this is not a clear reflection of real world usage as video creates a lot of load on the media server! The video usage on the server creates a lot more load than the number of users online!
Later edit: for tips on how to improov the performance of AVChat on Red5 see this thread on our forum.
2 thoughts on “Cpu and memory usage with AVChat 3 (text chat only mode), Red5 0.8 and a slow server”
Nice job and very nice post!
Can I ask how are you handling (in Red5 server) a user right when he’s connecting? I’m trying to build something quite similar with your chat (for online bidding), but I’m having problems when ~100 users try to connect all at once. I start getting errors like “Closing RTMPMinaConnection …. due to long handshake”. As I understand you added the clients one by one?
Thanks very much
We were adding about 1 user /second.
We have a lot of logic going on when a user connects!
Maybe you are trying to connect 100 all at once or have a really slow CPU.
As you can see in the charts handling connections is much more CPU demanding than just “being in the video chat”.