in reply to Re: Sockets: TMTOWTDI (BWWIB)?
in thread Sockets: TMTOWTDI (BWWIB)?

Regarding familiarity with the issues involved in the switched connections model, do you think the books that were recommended would be a sufficient teacher? At this point, the switched connections model is the most appealing to me.

The server won't be handling 10000+ connections. There's a way to scare me to wakefulness. Heh.

Replies are listed 'Best First'.
Re: Re: Re: Sockets: TMTOWTDI (BWWIB)?
by MarkM (Curate) on Dec 17, 2002 at 07:04 UTC

    I am positive that the books mentioned will be useful. Many people have recommended them to me over the years.

    For myself, I found reading books or articles that describe the concepts to be useful, and a good head start, but I found the actual experience of determining the problems in my own implementations to be more valuable in the long run. If you have the time, try implementing both, and then optimizing each to the best of your ability. Subject your code to a peer review either here, or within another Perl community, or people who work with you. You won't lose from the experience.

    If you don't have the time, I would still recommend either one of the process models, or the thread models, over switched connections. Since you are going to be using WIN32, the thread model is probably best.

    It took three generations to get my current pure-perl event loop and socket management code to the level it is now. With standard Intel hardware of yesteryear (400-800Mhz, single CPU), it is able to handle 1000+ active connections in 2 seconds. These three generations represent several months of work (at least a few weeks of solid work mixed with odd complaints regarding production environment behaviour or misbehaviour). This is why I recommend against it. If you still want to pursue this path, you may cut some corners by using an existing event loop such as the one used by the Tk module.

    I apologize, but I am not able to release the code I speak of at the current point in time. It is owned by my employer, and all that... I am more than happy to comment on code that you submit, though.

      I figured the answer was something along those lines - the books will help but they can't save me from problems in my implementation.

      I have plenty of time for this so I'm going to persue the select() method for now. This is my own personal pet project so there are no deadlines and no production environment concerns. At the very least it will crash less than the MUD codebase I've tinkered with in the past - it once segfaulted three times in a row before starting up and I hadn't even changed anything yet. Corner cutting goes against the grain for me so I think I'll just write it from scratch. Perfectionism strikes again.

      I figured the best way to learn was to hold my breath and jump in with both feet. This approach has worked for me so far, so why not now? :)

      No need to apologise for not releasing code - I certainly understand and the experience will be good for me anyway. Actually, given that you could release the code, I'm not sure I would look at it anyway - this program is as much about learning the ins and outs of network programming as it is about creating an interesting / useful project.