Forum OpenACS Q&A: Impact of Exec on server performance

Collapse
Posted by Kenny Chan on
Hi there,

I am looking into building a webapp that would need intensive use of cURL. I am wondering how much of the impact on server performance would be, if calling external program like cURL by "exec" intensively (multiple calls per user). Is this gonna make tons of child processes?

I understand that the PhotoDB module makes use of ImageMagik by exec'ing. In my understanding, exec'ing external program would start a processes. It sounds like a very non-scalable way of getting things done, regardless the flexibility of extending the capabilities of Tcl.

Does anyone have similar experience? Thank you in advance.

Sincerely,

Collapse
Posted by Eric Lorenzo on
Kenny,

Have you looked into using TclCurl? If it provides the functionality you want, it might be worth your trouble to get TclCurl working within AOLserver. This would at least get rid of the exec overhead.

However, if you're using cURL to retrieve resources from elsewhere on the web, that download time may turn out to be much more significant than exec overhead, meaning that TclCurl won't be any sort of silver bullet.

Collapse
Posted by Dan Wickstrom on
Last time I checked the TclCurl author was looking for somebody to help with aolserver integration.  If I had more time, I would do it, but I already have enough half finished projects laying around, so I'm not going to attempt to take it on.  Integrating TclCurl with aolserver would be a nice project for someone to take on, and it would be something that would benefit the whole community.  LibCurl is probably not thread-safe, so it would be necessary to protect it with mutexes.  Still, I think it would be pretty straightforward.

I don't think the time to retreive something vs. the exec time is really an issue.  If you have multiple users using the exec, it's going to eat your servers resources regardless of how long it takes to retreive something.

Collapse
Posted by Kenny Chan on
Hi All,

Yes, I have looked into TclCurl, but integrating it into Aolserver is out of my capability.

Is there any way to compile TclCurl, then make use of it by "package require" in Aolserver Tcl? And if it is possible, is this gonna solve the problem of using exec which eats the server resource?

Thank you again

Sincerely,

Collapse
Posted by Dan Wickstrom on
When you install aolserver, it recreates the tcl lib directory and includes the default packages that are part of the tcl distribution.  I think you can just copy the TclCurl package there and it should work with package require.  As an example, I have aolserver installed in /usr/local/aolserver, and the tcl libs are at /usr/local/aolserver/lib/tcl8.3, so if I were to install TclCurl, I would copy the tclcurl package directory to /usr/local/aolserver/lib/tcl8.3.

This should work with package require, but if libcurl is not thread-safe, you will still need to create a wrapper for the TclCurl commands that serializes access using a mutex.