Skip to content

Instantly share code, notes, and snippets.

@pcdinh
Created March 26, 2013 22:19
Show Gist options
  • Select an option

  • Save pcdinh/5249831 to your computer and use it in GitHub Desktop.

Select an option

Save pcdinh/5249831 to your computer and use it in GitHub Desktop.
SQLAlchemy consumes a lot of memory. Not a good sign to a high traffic website
With SQLAlchemy (on top of psycopg2 driver): 71MB per process
=============================================================
top - 14:29:23 up 55 days, 4:18, 3 users, load average: 0.00, 0.01, 0.05
Tasks: 99 total, 1 running, 98 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3840476k total, 3808680k used, 31796k free, 97716k buffers
Swap: 0k total, 0k used, 0k free, 2491464k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3868 dba 20 0 7416 316 212 S 0.0 0.0 0:06.02 /usr/lib/erlang/erts-5.8.5/bin/epmd -daemon
3879 dba 20 0 282m 198m 3972 S 0.0 5.3 17:26.95 /usr/lib/erlang/erts-5.8.5/bin/beam -K true -P 250000 -- -root /usr/lib/erlang -progname erl -- -home /opt/local/var/l
3895 dba 20 0 7380 420 336 S 0.0 0.0 0:00.05 inet_gethost 4
3896 dba 20 0 13720 828 676 S 0.0 0.0 0:00.02 inet_gethost 4
4388 dba 20 0 198m 71m 5968 S 0.0 1.9 0:00.84 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4389 dba 20 0 198m 71m 5992 S 0.0 1.9 0:00.84 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4422 dba 20 0 198m 71m 5992 S 0.0 1.9 0:00.83 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4476 dba 20 0 198m 71m 5992 S 0.0 1.9 0:00.83 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4503 dba 20 0 198m 71m 5968 S 0.0 1.9 0:00.81 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4508 dba 20 0 189m 69m 5160 S 0.0 1.9 0:00.77 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
4522 dba 20 0 189m 69m 5160 S 0.0 1.9 0:00.76 /usr/bin/python /srv/bin/dba_auth.py /srv/etc/settings_dev.py
Without SQLAlchemy (simple helper class on top of psycopg2): 17 MB per process
==============================================================================
top - 22:10:21 up 55 days, 11:59, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 82 total, 1 running, 81 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3840476k total, 3381220k used, 459256k free, 97716k buffers
Swap: 0k total, 0k used, 0k free, 2540384k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3868 dba 20 0 7416 316 212 S 0.0 0.0 0:06.29 /usr/lib/erlang/erts-5.8.5/bin/epmd -daemon
3879 dba 20 0 287m 210m 3972 S 0.0 5.6 18:21.14 /usr/lib/erlang/erts-5.8.5/bin/beam -K true -P 250000 -- -root /usr/lib/erlang -progname erl -- -home /opt/local/var/l
3895 dba 20 0 7380 420 336 S 0.0 0.0 0:00.05 inet_gethost 4
3896 dba 20 0 13720 828 676 S 0.0 0.0 0:00.02 inet_gethost 4
6775 dba 20 0 122m 17m 5484 S 0.0 0.5 0:00.32 /usr/bin/python /srv/dba_auth.py /srv/etc/settings_dev.py
6880 dba 20 0 122m 17m 5484 S 0.0 0.5 0:00.32 /usr/bin/python /srv/dba_auth.py /srv/etc/settings_dev.py
6944 dba 20 0 122m 17m 5484 S 0.0 0.5 0:00.31 /usr/bin/python /srv/dba_auth.py /srv/etc/settings_dev.py
7153 dba 20 0 122m 17m 5484 S 0.0 0.5 0:00.34 /usr/bin/python /srv/dba_auth.py /srv/etc/settings_dev.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment