I have a Perl server and when it boots up, it connects to 1000+ clients. It takes about 30-45 minutes to setup all the connections with SSL. I'm trying to decrease the start time to something more reasonable. I tried playing with threads to offload the work, but can't get it to work. Creating the socket in one thread and getting it back to the caller doesn't quite work as expected. Tried passing the file descriptor and recreating with IO::Socket::SSL->new_from_fd() to recreate the socket back in the caller but fails.
Does anyone have any suggestions as to how to approach creating this many sockets quickly? Or at least faster than O(n)...
UPDATE: Looks like POE framework is definitely something that I want to explore. The docs sound like it can do what I need. I'm building a Proof of concept now and having trouble specifically with accessing the created Socket objects in the Sessions. I can create the sockets in the POE sessions, but then after they are done, I want my main program to collect the created sockets into one hash. Anyone know how to retrieve objects from POE Sessions?
UPDATE: Have an idea involving either using a global variable and adding the sockets to that within the sessions, or keeping references to the created sessions and accessing their heaps to aggregate them. Trying it now...