[erlang-questions] Erlang VM will open all socket in every thread?

linbo liao llbgurs@REDACTED
Tue Dec 15 09:51:58 CET 2015


Hi,

Our Erlang Application hit an high slab cache memory issue.  Check the free
command and slabtop command, the reason is that proc_inode_cache (means
lots of inode in /proc)  consume lots of memory.

**  free command*

$ free -m
>              total       used       free     shared    buffers     cached
> Mem:          3697       3300        397          0        362        118
> -/+ buffers/cache:       2819        877
> Swap:            0          0          0
>

** slabtop *

 Active / Total Objects (% used)    : 5436406 / 5679810 (95.7%)
>  Active / Total Slabs (% used)      : 234780 / 234780 (100.0%)
>  Active / Total Caches (% used)     : 65 / 101 (64.4%)
>  Active / Total Size (% used)       : 2135436.95K / 2161607.05K (98.8%)
>  Minimum / Average / Maximum Object : 0.01K / 0.38K / 8.00K
>
>   OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
> 2609313 2609313 100%    0.19K 124253       21    497012K dentry
> 2503826 2503826 100%    0.61K  96301       26   1540816K proc_inode_cache
>

 And check the Erlang VM, it has 323 threads.  An interesting thing, all
thread will open almost same number of sockets.

$ ls -lht /proc/13197/task/ |wc -l
> 323
> $ ls -lht /proc/13197/task/13412/fd |wc -l
> 4776
> $ ls -lht /proc/13197/task/13414/fd |wc -l
> 4791
> $ ls -lht /proc/13197/task/13414/fd |head -10
> total 0
> lrwx------ 1 yunba users 64 Dec 15 16:40 4245 -> socket:[2103438292]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4248 -> socket:[2103411552]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4364 -> socket:[2097429782]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4609 -> socket:[2103438164]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4610 -> socket:[2103438165]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4612 -> socket:[2103438175]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4613 -> socket:[2103438176]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4614 -> socket:[2103438177]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4615 -> socket:[2103438178]
> $ ls -lht /proc/13197/task/13414/fd |head -10
> total 0
> lrwx------ 1 yunba users 64 Dec 15 16:40 4248 -> socket:[2103411552]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4364 -> socket:[2097429782]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4630 -> socket:[2097238946]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4631 -> socket:[2097236427]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4632 -> socket:[2097236430]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4633 -> socket:[2097238953]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4635 -> socket:[2097238954]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4637 -> socket:[2097238956]
> lrwx------ 1 yunba users 64 Dec 15 16:40 4639 -> socket:[2097238957]
> $ ls -lht /proc/13197/task/*/fd |wc -l
> 1524804
>

If application operate a socket, will it be opened in every Erlang VM
thread?

Thanks,
Linbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151215/22a137c3/attachment.htm>


More information about the erlang-questions mailing list