Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a program that has a large startup delay. (it needs to load lots of data from hard drive). So, I call it from the command line and provide it the name of input file, it processes that and prints output.

Now I need to figure out a way so that I can call the program again and again without incurring the startup delay. like a server? Is there a ready made solution for this? I have access to the source code, and can compile it again, but I don't have any idea how to code something up (haven't done systems programming)

share|improve this question
    
Reading the file should put the contents into the disk cache, and assuming there is enough RAM to go around, it'll still be there on the second invocation. If the second time around it needs as long to read the data from disk (as opposed to processing it, which is a very different problem), double-check your disk caching settings. –  Michael Kjörling May 20 '13 at 13:30
    
what kind of UI (if any) does your app use? –  Frank Thomas May 20 '13 at 14:37
    
@FrankThomas: It doesn't have a UI. It's not an app actually, I am using a program which takes in an english sentence and tells me what its semantic structure is. To do that it needs to load a large file, its database. I need to work with it interactively to run some experiments but there's a 120 second startup time every time (for every sentence) that's driving me crazy. If there's no solution I guess I could change the code and put the user input in a while(1) loop, but it would've been a pain if I didn't have source code. –  pushpen May 20 '13 at 17:22
    
"Remote Procedure Call(s)" (RPC) provides a way to do this that's not too hard (but not trivially easy, either). I believe Sun Microsystems developed it, so I don't know whether it's available on Linux. –  Scott May 20 '13 at 20:55
    
@Scott: I looked into RPC, i think it requires a server program. and the problem I am facing is that I want to wrap a process as a server? or rather what is the simplest way to convert a command line process into a server process? –  pushpen May 21 '13 at 5:48
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.