You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dan Yamins <dy...@gmail.com> on 2009/05/19 00:46:12 UTC

[users@httpd] Re: [graphviz-interest] Dot extremely slow when called from python cgi script

I'm having a problem with performance of the program "dot" (for rendering
graphs) when called from a python cgi script, served by an apache virtual
host.  I'm writing this email both the apache httpd list as well as the
graphviz users lists (hoping some intersection might be useful).

I'm using OSX 10.5.6 and graphviz2.22 (built via macports).

When I run a simple python script that calls dot (via a system call) to
render a small graph, it takes about .04 seconds, which is normal.  But when
I run the same call via CGI script it takes roughly 100 times longer (4
seconds).     I've tried graphs of various sizes, ranging from very tiny
graphs (4 nodes) to much larger graphs.   The 4 seconds figure for the CGI
script doesn't change much except for very large graphs, so the time spent
in the CGI script is probably not coming from the actual rendering itself.

I posted this problem some weeks ago on these lists, and got the following
enlightening response:

>A hunch is that some cache is not seen or is not available.
>Could be the fontconfig cache.  It could be the case that you
>have a ~dyamins/.fontconfig but httpd is not able to create one
>and there is no system cache.

This did indeed seem to be the problem.  I wrote back:

> I do have a ~/.fontconfig directory containing cache files.  When I delete
it, the performance of the command line script is just as slow as the cgi >
script until the next time the command is run (e.g. after the cache is
remade).    So I  guess the question becomes: how do I get apache and the >
CGI script to see and use the .fontconfig caches?

However, I never received an answer about about how to get apache to see the
.fontconfig caches.

Any thoughts would be really appreciated.

Thanks,
Dan

Re: [users@httpd] Re: [graphviz-interest] Dot extremely slow when called from python cgi script

Posted by Dan Yamins <dy...@gmail.com>.
>If you just rebuild the system caches, does that help?

>   (as root)
>  # rm /var/cache/fontconfig/*
>   # fc-cache -f -v


Well -- so I guess since my fontconfig installation is via macports, Ryan
was right in suggesting that my fontconfig was in /opt/local.  BUt cleaning
it doesn't seemed to have helped.

My graphviz installation is not from macports though -- would this make a
difference?



> When you run your script (any script) as a cgi program under Apache, it
> runs under the user-id under which Apache itself runs.
> That user-id may, or may not, have the same environment as when you run the
> script from the command-line, under (presumbaly) your own user-id.


I've set my apache user to be my username in the httpd.conf file, so
shouldn't that not be an issue?


> If the environment for your own user-id includes some environment variables
> which need to be set to indicate to the script where to find certain things
> (like maybe your .fonconfig cache file(s)),


I don't think it does, at last I don't see anything obvious in my user
environment (where things are fast).

Re: [users@httpd] Re: [graphviz-interest] Dot extremely slow when called from python cgi script

Posted by André Warnier <aw...@ice-sa.com>.
Eric Covener wrote:
>> However, I never received an answer about about how to get apache to see the
>> .fontconfig caches.
> 
> Apache doesn't care about them.  Maybe your CGI does, but setting up
> the execution environment for your CGI isn't really something OT here.
> 
I'll add something to the above :
When you run your script (any script) as a cgi program under Apache, it 
runs under the user-id under which Apache itself runs.
That user-id may, or may not, have the same environment as when you run 
the script from the command-line, under (presumbaly) your own user-id.
If the environment for your own user-id includes some environment 
variables which need to be set to indicate to the script where to find 
certain things (like maybe your .fonconfig cache file(s)), then you can 
set similar environment values via the Apache SetEnv directive, prior to 
running your cgi script.
Look it up here :
http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv

What we Apache guys do not know, is what exactly your script needs as an 
environment. That is off-topic here, and you must find this out in the 
appropriate command documentation, or on some related help forum.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: [graphviz-interest] Dot extremely slow when called from python cgi script

Posted by Eric Covener <co...@gmail.com>.
> However, I never received an answer about about how to get apache to see the
> .fontconfig caches.

Apache doesn't care about them.  Maybe your CGI does, but setting up
the execution environment for your CGI isn't really something OT here.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org