for permanent services, is Java preferable to PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    for permanent services, is Java preferable to PHP?

    I want to offer my friends a ping service, where certain of their
    pages will be called once a week. My impression is that no PHP script
    can be made to run very long. Assuming a situation where I don't have
    access to cron, should I write the service as Java application and set
    it to run forever on my webserver?

    Or let's put it another way. Assume I want to write a remind service,
    where people are reminded of friend's birthdays. Should I assume this
    is better done in Java than PHP?
  • Andy Hassall

    #2
    Re: for permanent services, is Java preferable to PHP?

    On 18 Jul 2004 14:07:08 -0700, lkrubner@geocit ies.com (lawrence) wrote:
    [color=blue]
    >I want to offer my friends a ping service, where certain of their
    >pages will be called once a week. My impression is that no PHP script
    >can be made to run very long. Assuming a situation where I don't have
    >access to cron, should I write the service as Java application and set
    >it to run forever on my webserver?[/color]

    I don't see any clear advantage to using Java over PHP in such a way, both
    would be bad. cron really is the way to go here; why are you assuming it is
    unavailable?

    If it is truly unavailable, I'd knock up a small shell script or C program to
    emulate it using sleep() calls, to keep the always-running part as lightweight
    as possible. Both PHP and Java have noticable memory footprints.

    PHP can run for as long as you like, it just has by default a limiter on it as
    its normal usage is in response to HTTP requests, where it doesn't make sense
    to have very long runtimes. This can easily be disabled.
    [color=blue]
    >Or let's put it another way. Assume I want to write a remind service,
    >where people are reminded of friend's birthdays. Should I assume this
    >is better done in Java than PHP?[/color]

    Given that this should be run at most once per day, it's not the language
    that's the issue, it's the scheduling.

    --
    Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
    http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

    Comment

    • Chung Leong

      #3
      Re: for permanent services, is Java preferable to PHP?

      "lawrence" <lkrubner@geoci ties.com> wrote in message
      news:da7e68e8.0 407181307.4cab5 65f@posting.goo gle.com...[color=blue]
      > I want to offer my friends a ping service, where certain of their
      > pages will be called once a week. My impression is that no PHP script
      > can be made to run very long. Assuming a situation where I don't have
      > access to cron, should I write the service as Java application and set
      > it to run forever on my webserver?
      >
      > Or let's put it another way. Assume I want to write a remind service,
      > where people are reminded of friend's birthdays. Should I assume this
      > is better done in Java than PHP?[/color]

      A really dumb (or clever, depending on your perspective) way to submit the
      URL to the script Google and other search service. When the search-bot
      update its database, your script would be called.


      --
      Obey the Clown - http://www.conradish.net/bobo/


      Comment

      • lawrence

        #4
        Re: for permanent services, is Java preferable to PHP?

        "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<3vqdnaIb2 bvPgWbdRVn-qw@comcast.com> ...[color=blue]
        > "lawrence" <lkrubner@geoci ties.com> wrote in message
        > news:da7e68e8.0 407181307.4cab5 65f@posting.goo gle.com...[color=green]
        > > I want to offer my friends a ping service, where certain of their
        > > pages will be called once a week. My impression is that no PHP script
        > > can be made to run very long. Assuming a situation where I don't have
        > > access to cron, should I write the service as Java application and set
        > > it to run forever on my webserver?
        > >That
        > > Or let's put it another way. Assume I want to write a remind service,
        > > where people are reminded of friend's birthdays. Should I assume this
        > > is better done in Java than PHP?[/color]
        >
        > A really dumb (or clever, depending on your perspective) way to submit the
        > URL to the script Google and other search service. When the search-bot
        > update its database, your script would be called.[/color]

        That is clever, but not reliable, yes?

        Comment

        • lawrence

          #5
          Re: for permanent services, is Java preferable to PHP?

          Andy Hassall <andy@andyh.co. uk> wrote in message news:<f3tlf0l9k asknhirj0r173hc 5ariet12n2@4ax. com>...[color=blue]
          > On 18 Jul 2004 14:07:08 -0700, lkrubner@geocit ies.com (lawrence) wrote:
          >[color=green]
          > >I want to offer my friends a ping service, where certain of their
          > >pages will be called once a week. My impression is that no PHP script
          > >can be made to run very long. Assuming a situation where I don't have
          > >access to cron, should I write the service as Java application and set
          > >it to run forever on my webserver?[/color]
          >
          > I don't see any clear advantage to using Java over PHP in such a way, both
          > would be bad. cron really is the way to go here; why are you assuming it is
          > unavailable?
          >
          > If it is truly unavailable, I'd knock up a small shell script or C program to
          > emulate it using sleep() calls, to keep the always-running part as lightweight
          > as possible. Both PHP and Java have noticable memory footprints.
          >
          > PHP can run for as long as you like, it just has by default a limiter on it as
          > its normal usage is in response to HTTP requests, where it doesn't make sense
          > to have very long runtimes. This can easily be disabled.
          >[color=green]
          > >Or let's put it another way. Assume I want to write a remind service,
          > >where people are reminded of friend's birthdays. Should I assume this
          > >is better done in Java than PHP?[/color]
          >
          > Given that this should be run at most once per day, it's not the language
          > that's the issue, it's the scheduling.[/color]

          You're right, cron is available. I've thought about it and realized I
          gain little advantage going with PHP or Java. My first thought was to
          avoid cron because I'm trying to write my code as a software that
          people can download and use in hosted environments. But hosted
          environments may not allow Java applications (as opposed to Java
          applets).

          Still, if I were to write this service as a shell script, I'd have to
          tweak it for every server I use. If I write it in PHP or Java, then I
          could write it once, and I would not have to tweak it as I move from
          server to server. I realize I can reset the default time out for PHP,
          but I want that default limit to be there for all the PHP scripts that
          run in response to http requests. I don't think I can have two
          installations of PHP on my server, can I? It runs Red Hat 9 on Linux.

          For all those reasons, I'm still thinking that Java might be best.
          Your argument that a shell script would be much lighter than Java is a
          good one, but the whole script (even in Java) is going to be so small
          it doesn't seem like it can matter much anyway.

          Comment

          Working...