I have just one table with 20 fields, and the reads and writes are just select and insert operations in that table
B) I/O applications: 1- Emysql 2-Mnesia
C) SMP parameters:
1- SMP enabled, no. of schedulers = no. of cpu cores
2-SMP enabled, no. of schedulers = 1
3- SMP disabled
D) Erlang OTP versions:
1- Erlang R12B (The SMP has only one run-queue and multiple schedulers)
2- Erlang R15B (Improved SMP, 1 run-queue per each scheduler)
The tests included all possible combinations from A,B,C,D. They were run in Solaris 10 x86 (a 16 cores machine).
In general these were the results I got:
Emysql driver:1- There is a a big difference in performance between SMP enabled and disabled in both the Erlang versions (R12 and R15) for both read and write tests. So I can say that SMP rocks! However, you have to have enough load to achieve that (for low load I could not see any difference, sometimes it was even better to disable SMP)
2- I was expecting a much better performance for SMP enabled (no. of cores = no. of schedulers) in R15 than in R12, since the schedulers' logic has changed a lot from R12 to R15. But the results were more or less the same. I was thinking since I had a multithreaded db like MySql, a multiple db-connections driver as Emysql, and SMP with multiple schedulers with their own run queues, I could get better results than in R12 where there is only one run-queue and multiple schedulers (more lock contention).
Is it maybe because the processes are just doing IO and nothing CPU-intensive?
3- I realized that CPU usage in R15 SMP enabled is twice higher than the CPU use in R12 SMP enable. All the cores have a CPU usage over 90%, and I can see that the beam process is using up to 75-80% of the CPU, the rest is the mysql daemon process. Is it because in R15 the scheduling algorithm has become more complex?
Mnesia
I have only one table (as I said before) created with the attribute disc_copies, and it is stored only in one node. The whole table fits in RAM, and I tried to keep it simple by controlling the size of the table during my tests, in order not exceed RAM capacity
4- For the write tests in Mnesia I see the same behavior as in Mysql. However, since the data are all loaded in RAM, the session duration is shorter, and the gain in performance between SMP enabled and disabled is not as huge as in Mysql.
5- For the read tests, I have two observations. First, the dirty reads are 10 times faster than the reads that use transactions. Second, I have better results for SMP disabled (twice faster, though in both cases the session duration is in order of millisecods, 70 msec vs 30 msec).
6- Same as in Mysql, no difference in performance between R12 and R15 with SMP enabled, for both read and write tests.
If you have read so far, and have a comment on my results, you are welcome. Especially about the no difference btw R12 and R15 and the high CPU usage in R15 when the applications are IO-bound.
Thanks,
Erisa