6

I have a node.js process which writes to many different sqlite databases. Sqlite can handle only one concurrent write per database, which is fine since there will be only one write per database at a time, but writes to multiple different databases at the same time.

How do I determine where a write bottleneck in the system is: 1. The OS (Debian Wheezy) 2. The SSD 3. Node.js

I assume sqlite won't be the bottle neck, since there won't be concurrent writes per database, but writes happening to different databases concurrently.

EDIT: I'm trying to determine the bounding factor so I can decide when to scale to a new box, or add more node.js processes etc.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Kaizer Sozay
  • 739
  • 3
  • 13
  • 19

2 Answers2

5

The sar command gives you all sorts of useful system activity. For example, for general CPU usage:

sar -u 2 10

shows (note - this is not a debian system, but it should be similar):

09:31:55 AM       CPU     %user     %nice   %system   %iowait    %steal     %idle
09:31:57 AM       all      1.71      0.00      1.14      0.00      0.00     97.14
09:31:59 AM       all      1.00      0.00      0.50      0.00      0.00     98.51

I/O wait time is displayed. The system figure will also be impacted by I/O due to the CPU usage required to process requests, but the iowait time indicates delays attributed to the device.

For disk usage:

sar -d 2 110

gives:

09:33:03 AM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
09:33:05 AM    dev8-0     11.06      0.00    112.56     10.18      0.02      1.59      0.45      0.50
09:33:05 AM    dev8-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

So the wait time (await) may be of interest in determining if the system is I/O bound.

rghome
  • 407
  • 2
  • 6
2

Try to profile your application with iotop.

 sudo apt-get install iotop
 sudo iotop
Milind Dumbare
  • 886
  • 1
  • 5
  • 12