Hi Nishant, I had a similar problem ( http://lists.zeromq.org/pipermail/zeromq-dev/2012-July/017665.html), but from my experience you should not have the file descriptor problem opening "only" 5 sockets every minute. I successfully implemented a socket pool to solve the issue, but you should definitely redesign if you can :)
Regards, Thiago On Thu, Jan 3, 2013 at 1:39 PM, Nishant Mittal <[email protected]> wrote: > Andy, your arguments make sense and I am now creating/closing sockets > inside each thread. and at some point, as Pieter suggested, we will look at > redesigning the app so work load is distributed using zeromq to worker > threads. > > thanks > > > On Thu, Jan 3, 2013 at 7:09 AM, Andy Ballingall TF < > [email protected]> wrote: > >> Nishant, >> >> Though not directly related to your question (which is useful to know), I >> wondered if your use-case should present problems in any event. >> >> Isn't the only issue with file descriptors and tcp sockets that the file >> descriptor cannot be released until TIME_WAIT has elapsed? >> >> TIME_WAIT is 'maximum segment lifetime * 2' (MSL*2), and is usually >> something between 2 and 10 minutes. >> >> 'http://en.wikipedia.org/wiki/Maximum_segment_lifetime >> >> In your use case, you're only opening a few sockets a minute, so you >> shouldn't overwhelm the system with sockets in TIME_WAIT state. >> >> As far as I know, the only use-cases where this matters is if your rate >> of socket creation and destruction is sufficiently high to result in a >> steadily growing number of TIME_WAIT sockets which hit the kernel limit. >> >> If, over any specific period of time of length TIME_WAIT, your rate of >> socket destruction is guaranteed to be below the kernel limit, then you >> shouldn't reach that limit at all should you? >> >> Andy >> >> >> >> >> On 2 January 2013 21:23, Nishant Mittal <[email protected]> wrote: >> >>> I know that zmq_sockets are not thread safe. however, is it an issue if >>> I ensure a socket is used ONLY by 1 thread at a time? >>> >>> the reason is ... >>> 1) my application creates 5 threads, does some calcs and then the >>> threads exit >>> 2) this is done every minute. so every minute 5 new threads are created. >>> 3) I think i will run into a file descriptor issue if i create sockets >>> inside the thread (every time the thread is launched). so planning to >>> create 5 sockets when my application starts and then use 1 socket from 1 >>> thread. >>> >>> is this going to be an issue? >>> >>> thanks >>> Nishant >>> >>> >>> _______________________________________________ >>> zeromq-dev mailing list >>> [email protected] >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> >>> >> >> >> -- >> Andy Ballingall >> Senior Software Engineer >> >> The Foundry >> 6th Floor, The Communications Building, >> 48, Leicester Square, >> London, WC2H 7LT, UK >> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906 >> Web: http://www.thefoundry.co.uk/ >> >> The Foundry Visionmongers Ltd. >> Registered in England and Wales No: 4642027 >> >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> >> > > > -- > *Nishant Mittal* > Director, Product Development > *Rosenblatt Securities Inc*. > 20 Broad Street > New York, NY 10005 > > Direct: 212-607-3159 > Mobile: 646-504-2629 > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
