L
Lothar Scholz
Hello Doug,
DB> if you had a way to register what modules your app depended on, then you
DB> could make sure to load those in the master ruby process that the fcgi
DB> children would be forked from. copy-on-write would then make the kids
DB> use less memory than if each fcgi was spawned on the fly and loaded the
DB> modules on their own. that would be happening at a lower level than
DB> ruby's GC, so i figured that would work.
DB> but it sounds like you're saying that even if the code did that, the
DB> first GC run in the child would walk the list of data/code nodes and
DB> twiddle them in one way or another, causing copy-on-write to happen for
DB> all nodes, and negating any benefit from being forked from a master
DB> parent process. did i read you correctly? if so, that's interesting, i
DB> never expected that...
Yes seems that you got my point. A lot of the ruby data part will
always be copied with the first GC run. I don't know how much memory
is used by the interpreter and the *.so extensions, but i doubt that it
is not the huge part. Each data member has a flag as part of the
allocated memory that will be flagged in the mark phase.
But memory consumption is like performance profiling: not very
intuitive, so someone with a lot of time should measure the things
a little bit more. But i pay him a few beer's on the next Ruby Conf
if i'm wrong with my assumption.
DB> doug
DB> if you had a way to register what modules your app depended on, then you
DB> could make sure to load those in the master ruby process that the fcgi
DB> children would be forked from. copy-on-write would then make the kids
DB> use less memory than if each fcgi was spawned on the fly and loaded the
DB> modules on their own. that would be happening at a lower level than
DB> ruby's GC, so i figured that would work.
DB> but it sounds like you're saying that even if the code did that, the
DB> first GC run in the child would walk the list of data/code nodes and
DB> twiddle them in one way or another, causing copy-on-write to happen for
DB> all nodes, and negating any benefit from being forked from a master
DB> parent process. did i read you correctly? if so, that's interesting, i
DB> never expected that...
Yes seems that you got my point. A lot of the ruby data part will
always be copied with the first GC run. I don't know how much memory
is used by the interpreter and the *.so extensions, but i doubt that it
is not the huge part. Each data member has a flag as part of the
allocated memory that will be flagged in the mark phase.
But memory consumption is like performance profiling: not very
intuitive, so someone with a lot of time should measure the things
a little bit more. But i pay him a few beer's on the next Ruby Conf
if i'm wrong with my assumption.
DB> doug