[stgt] tgtd memory usage

Mike Anderson andmike at linux.vnet.ibm.com
Wed Apr 6 20:14:58 CEST 2011

Neil Skrypuch <neil at pollstream.com> wrote:
> On April 6, 2011 2:57:44 am Or Gerlitz wrote:
> > Neil Skrypuch wrote:
> > > To the original poster: more likely you ran out of file descriptors and
> > > the error message is just deceptive. The default per process fd limit is
> > > 1024 (2 fds per thread = ~500). Try ulimit -n 20000, then restart tgtd in
> > > the same shell.
> >
> > I wasn't sure to follow on the "2 fds per thread" part of your comment,
> > specifically, it looks like in tgt the number of fds grows by one per
> > non controller lun. So the over number of fds used is a constant number
> > opened either on init or when the first target/lun are defined, and then
> > another one per lun. This could be easily seen/verified using "lsof -p
> > PID" with PID being the tgtd process-id
> >
> > Or.
> I was just throwing a wild guess out there based on the numbers. Though, 
> network sockets also count towards the fd limit, so if one initiator was 
> connected per LUN, that would work out to 2 fds per thread.

Using "lsof -p" or looking in /proc/$PID/fd I am seeing a base of 14
fds (i.e. with no targets / luns defined). I then see the 1 fd per real
lun (4 targets with 250 luns each gives 1014 total). I then login to the
targets and generate 4 more fds from the sockets (1018 total).

Michael Anderson
andmike at linux.vnet.ibm.com
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list