Recommended method for persistent process(es)

Hi there,

I have need of a persistent process on my VPS for opening, and maintaining, a connection to a remote service. It shouldn’t be particularly demanding as it only deals in tiny, relatively infrequent data packets, but PHP is unsuitable of course as the connection can’t keep dropping.

There is an existing Java implementation of a service for doing what I need, but it’s structured as more of a client than a server process, plus it has a lot of additional overhead that I’m not interested in, and doesn’t do a few things that I want it to, so I’m tempted to just create a new program of my own.

Anyway, I’m curious to know what the best supported method(s) for persistent processes are, and if there are any favoured methods? I’m familiar with both Java and Javascript so I was thinking of either a Java Servlet or maybe node.js; what I’m doing has no particular need for multi-threading. All I really need is the ability to open network connections to a remote server so I can send and receive byte data as required.

I should also note that I’m terrible when it comes to server management; so I’d really like something I can deploy easily, though of course minimising overhead is useful too :slight_smile:

Sorry to bump this, but I’m still interested in what Dreamhost’s support is like for Java servlets and/or Node.js on a VPS? Is it easy to setup? Can anyone give me an idea of which would be the better method for use with Dreamhost, and if there are any easy setup guides I could use to get started?

I’m liking Node.js actually, but I think for what I need Java may be the more compatible but I’m investigating both. In particular, as far as I can see, node.js only support web-sockets which means it can’t create arbitrary connections to any server, but can only communicate with servers that specifically support web-sockets connections. Is that true, or can I send arbitrary binary data to a server (and receive replies)?
Are there any other possibilities I should look into for persistent running services?

That isn’t true at all. node.js supports tcp sockets just like any other language (using the “net” module). Websockets are only necessary when communicating with a browser.

As far as the requirements you’ve described, though, any language would really be likely to work just fine. Even PHP would probably be acceptable if it’s run as a standalone process, not from the web server.

Okay, no idea how I managed to miss that then!

In that case, are there any guides for how to set up node.js etc., does it require my server to be setup manually? Currently VPS is managed, or can I do this under a managed server as well?

I’m still fooling around with node.js locally, but macports made it really easy to install so I have almost zero idea how to go about it on a Dreamhost server :slight_smile:

All I could find was a note on the wiki basically saying not to do it on a shared host, but that’s not an issue, is there anything somewhere else that goes into more detail? Any particular settings or paths I need to know that are specific to adding node.js on a dreamhost account?

This post has been on my “I want to test” list for a while: