Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

POE and time

by carcassonne (Pilgrim)
on Nov 07, 2005 at 11:28 UTC ( #506292=perlquestion: print w/replies, xml ) Need Help??

carcassonne has asked for the wisdom of the Perl Monks concerning the following question:

Folks, I'm considering using POE for a project and I'd like some feedback from people who used it in real, time-lasting projects.

The task at hand is not time-intensive. It will receive some TCP?IP data about each 10 seconds, do some transformation to it (format it CSV, workbook, etc...) and store it. It will also oversee some log files. it will also send heartbeat signal through a WiFi connection about each second or so. Through this WiFI conection it will accept some simple commands from a user and reply with some short status information. At times, it may handle two TCP/IP connections at a time, but again, nothing very intensive.

My concern is about keeping time accuracy. The project will run 24/24. I have concern that POE may introduce a time lag over time that could result in, say, losing 10 minutes per day or so. Which would be a definite show stopper.

Also, what's the difference between the Event module and POE ? Is Event used by POE ?

I'd like to have feedback from people who implemented POE.

Thanks a lot and cheers.

Replies are listed 'Best First'.
Re: POE and time
by rob_au (Abbot) on Nov 07, 2005 at 12:58 UTC
    I have used both Event and POE for a variety of projects and am currently using Event for a very-high profile project which provides interaction between a real-time communication server and digital signage. The primary difference between these modules is that POE provides a more complete, abstract and higher level interface to the event queue - While this may permit more rapid development of event-based services, it does introduce additional code overhead to the event-based solution.

    As such, the choice between Event and POE is the same as any where selecting libraries that abstract core system services, balancing the ease of use and development offered by the abstracted interface against the performance cost levied by this abstraction - That being said, irrespective of the library selected, there is no reason why code could not be introduced to reference code performance against a known time source such as a NTP server.

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001000000000'"

Re: POE and time
by Ultra (Hermit) on Nov 07, 2005 at 12:47 UTC

    My concern is about keeping time accuracy. The project will run 24/24. I have concern that POE may introduce a time lag over time that could result in, say, losing 10 minutes per day or so. Which would be a definite show stopper.

    I don't understand your point here... what do you mean by "losing 10 minutes" ??

    I can't comment on the differences between Event and POE as I haven't used Event.

    But AFAIK you can use Event inside POE. Take a look at: POE::Loop

    Dodge This!
      I don't understand your point here... what do you mean by "losing 10 minutes" ??

      The PC clock loosing minutes over days, i.e. its clock lagging behind so that in three days instead of 15:00 you'd have 14:20, for instance. Or maybe just 14:57 but still missing accuracy. That's my concern. Events will be logged periodically to a log file and precise time (to the minute at least) is important.

      The machine will not have access to a NTP server.

        And how would you expect a POE program (or any other program in this respect) to know how much time your computer 'loses' ?

        You need a synchronization method, whether a NTP server to sync with, or you know precisely that after X seconds spent, the delay is x seconds and you adjust the time yourself.

        Dodge This!

        I'm not sure I understand your question. Running an application using POE (or indeed any other perl module) shouldn't affect the accuracy of your PC's clock. That depends largely on the hardware in the computer (which is generally pretty inaccurate from what I remember).

        If your problem is that you want this application to generate logs with an accurate timestamp, then the ONLY way to do this is to have the PC's clock synchronised with a remote source that is more accurate. NTP is ONE way to do this. You could, of course, invent your own alternative to NTP (Microsoft did this with their "domain time service") - however you're unlikely to get anywhere near the accuracy of NTP by rolling your own (as Microsoft demonstrated).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://506292]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2019-06-19 01:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (83 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!