Re: Improving performance in a POE application?
On Fri, 09 Jun 2006 11:15:53 -0400 Apocalypse wrote: +-- | Chris Fedde wrote: | > On Fri, 09 Jun 2006 15:10:48 +0100 Nick Williams wrote: | > +-- | > | I never knew about POE::Devel::Profiler and I'm learning rapidly about | > | it now with my own visualizer. Most cool. However it highlights | > | something I've wanted for a while: names on sessions. I'm just referrin g | > | to something symbolic that can be attached to sessions in order to work | > | out in debuggers/profilers what's going on instead of session ID's like | > | '4822813', but without the side-effects that aliases have. Is there a | > | way of doing this? If not, could it be in an enhancement request? | > +-- | > | > >From POE::Kernel | > | > # Set an alias for the current session. | > $status = $kernel->alias_set( $alias ); | > | > See also the section titled | > | > "Numeric Session IDs and Symbolic Session Names (Aliases)" | > | > I guess that it's a bit odd that it's a Kernel method until you realize | > where the info about an alias needs to go | > | > -- | > Chris Fedde | > | > | The side-effects Nick was talking about is that aliases will make the | session live indefinitely, and I'm sure that will screw up a lot of | programs out there :( | | Nick, I believe you can make a rfc for something like | $session->label_sess( "foo" ); | | I don't think that will be a disruptive change, and somebody could | implement it quickly... +-- I did overlook that "but without the side-effects that aliases" phrase. I'm sorry about that. I wonder if just stuffing some value in the heap would be good enough. I'm also a bit confused about how it would be used. For example a POE program may have a large number of sessions either all at once or in some complex sequence. Automaticaly assigning unique names to each session would be little better than using numbers. It seems to me that the logic for deciding when to call $session->label_sess( "foo" ); and the logic for dealing with an alias at birth and death of a session have roughly the same complexity. As always I'm probably overlooking something else that is obvious. -- Chris Fedde
Re: Improving performance in a POE application?
A little alias cleanup isn't that difficult to fathom. When you are through with the session just alias_remove(). I would go so far as to say that is pretty standard fair when making sure POE cleans up after itself. As for the performance bit, I was only able to get around 250 or so active TLS connections (each represented as their own session) going in my XMPP-Core server implementation before the CPU was redlining and I couldn't handle the load to handshake more connections (they would timeout). Granted, this was on a 800mhz duron with 256MB of ram, with the load tester on the same machine... On 6/9/06, Apocalypse <[EMAIL PROTECTED]> wrote: Chris Fedde wrote: > On Fri, 09 Jun 2006 15:10:48 +0100 Nick Williams wrote: > +-- > | I never knew about POE::Devel::Profiler and I'm learning rapidly about > | it now with my own visualizer. Most cool. However it highlights > | something I've wanted for a while: names on sessions. I'm just referring > | to something symbolic that can be attached to sessions in order to work > | out in debuggers/profilers what's going on instead of session ID's like > | '4822813', but without the side-effects that aliases have. Is there a > | way of doing this? If not, could it be in an enhancement request? > +-- > > >From POE::Kernel > > # Set an alias for the current session. > $status = $kernel->alias_set( $alias ); > > See also the section titled > > "Numeric Session IDs and Symbolic Session Names (Aliases)" > > I guess that it's a bit odd that it's a Kernel method until you realize > where the info about an alias needs to go > > -- > Chris Fedde > > The side-effects Nick was talking about is that aliases will make the session live indefinitely, and I'm sure that will screw up a lot of programs out there :( Nick, I believe you can make a rfc for something like $session->label_sess( "foo" ); I don't think that will be a disruptive change, and somebody could implement it quickly... -- Apocalypse Homepage: http://JiNxEdStAr.0ne.us IRC:[EMAIL PROTECTED] IRC:[EMAIL PROTECTED] Perl Stuff: http://search.cpan.org/~APOCAL/
Re: Improving performance in a POE application?
Chris Fedde wrote: On Fri, 09 Jun 2006 15:10:48 +0100 Nick Williams wrote: +-- | I never knew about POE::Devel::Profiler and I'm learning rapidly about | it now with my own visualizer. Most cool. However it highlights | something I've wanted for a while: names on sessions. I'm just referring | to something symbolic that can be attached to sessions in order to work | out in debuggers/profilers what's going on instead of session ID's like | '4822813', but without the side-effects that aliases have. Is there a | way of doing this? If not, could it be in an enhancement request? +-- >From POE::Kernel # Set an alias for the current session. $status = $kernel->alias_set( $alias ); See also the section titled "Numeric Session IDs and Symbolic Session Names (Aliases)" I guess that it's a bit odd that it's a Kernel method until you realize where the info about an alias needs to go -- Chris Fedde The side-effects Nick was talking about is that aliases will make the session live indefinitely, and I'm sure that will screw up a lot of programs out there :( Nick, I believe you can make a rfc for something like $session->label_sess( "foo" ); I don't think that will be a disruptive change, and somebody could implement it quickly... -- Apocalypse Homepage: http://JiNxEdStAr.0ne.us IRC:[EMAIL PROTECTED] IRC:[EMAIL PROTECTED] Perl Stuff: http://search.cpan.org/~APOCAL/
Re: Improving performance in a POE application?
On Fri, 09 Jun 2006 15:10:48 +0100 Nick Williams wrote: +-- | I never knew about POE::Devel::Profiler and I'm learning rapidly about | it now with my own visualizer. Most cool. However it highlights | something I've wanted for a while: names on sessions. I'm just referring | to something symbolic that can be attached to sessions in order to work | out in debuggers/profilers what's going on instead of session ID's like | '4822813', but without the side-effects that aliases have. Is there a | way of doing this? If not, could it be in an enhancement request? +-- >From POE::Kernel # Set an alias for the current session. $status = $kernel->alias_set( $alias ); See also the section titled "Numeric Session IDs and Symbolic Session Names (Aliases)" I guess that it's a bit odd that it's a Kernel method until you realize where the info about an alias needs to go -- Chris Fedde
Re: Improving performance in a POE application?
I never knew about POE::Devel::Profiler and I'm learning rapidly about it now with my own visualizer. Most cool. However it highlights something I've wanted for a while: names on sessions. I'm just referring to something symbolic that can be attached to sessions in order to work out in debuggers/profilers what's going on instead of session ID's like '4822813', but without the side-effects that aliases have. Is there a way of doing this? If not, could it be in an enhancement request? Nick. Michael Giambalvo wrote: I'm working on improving the performance of our POE based application. Our application consists of clients built with POE::NFA that use a POE::Component::Client::TCP to connect to a server. It seems that we max CPU utilization at around 300 clients. I'm making use of POE::Devel::Profiler, and I'm trying to trim the fat from our events as much as possible. However, I was wondering if there might be ways I can improve performance of the POE Kernel itself. Right now, we're using the default loop. Would Glib or some other loop perform better? Is there a particular kernel or system configuration that can significantly affect POE performance? Would sessions be significantly faster than NFAs? Is there a way to improve performance of the TCP client component? Also, does anyone know roughly how many events per second POE can handle? I did a barebones test that seemed to indicate 6000 events per second, but I don't think my test was representative of the conditions you have when you have hundreds of sessions throwing events around. Thanks.
Re: POE not doing what I'm expecting it to......
Quoting Peter Farmer ([EMAIL PROTECTED]): > > Now, when I run the script, because of the > $kernel->delay_set("scheduler",10) at the end of the "sche" sub, I'm > expecting to see "sche" running at about 1149783936 or 1149783938 or > as soon as possible after the 10 seconds have passed not 1149783946 > once all the other event "job_runners" are finished. > Actually this is what I would expect to happen. You yield 10 slow events. They all get scheduled to happen at the same time, the current one. Poor POE tries to do them, but they keep being uncooperative and not yielding back. Everytime POE gets a look in it sees events it should have done in the past. What should it do, the old events or the new 'now' event, your alarm? It will do the old stuff first. The general solution to this is be more cooperative. Be more fine grained. Instead of this: foreach my $line (@lines) { # process $line } write something like this: sub process_line { # get kernel, heap, @lines could be in the heap if (@lines) { unshift $line; # process $line $kernel->yield(process_line, @lines) } } or do a few chunks at a time. Cheers, -- Merijn Broeren | Sometime in the middle ages, God got fed up with us Software Geek | and put earth at sol.milky-way.univ in his kill-file. | Pray all you want, it just gets junked.
Re: POE not doing what I'm expecting it to......
Thanks to everyone who took the time to reply, I now have a much better understanding of how to write POE applications. Thanks, -- Peter Farmer