Re: Dot extremely slow when called from python cgi script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday, April 25, 2009, Dan Yamins <dyamins@xxxxxxxxx> wrote:
> 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).
>

Have you got fastcgi enabled? I doubt seriously that it would account
fir 3.94 seconds but might help a little bit.. I believe it caches
opcode..

Also have you thought about reading the apache log? If the time
differential really is on the apache side I'm sure there will be reams
of data to slog through
> 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.
>
> Not all system calls in my CGI scripts take longer than their "regular called at the prompt" version (e.g. if I do a simple 'pwd' it is comparable in time when called in the CGI script versus the non-served script.   (And many others perform fine.)   The problem just seems to be with the graphviz dot executable.
>
> Below are the two test scripts that when run on my machine illustrate the problem.
>
> Any help (from either community) would be great.
>
> Thanks!
> Dan
>
>
> Here's the python script: run as "python test.py"
>
> ------test.py-----------------
> import os, time
>
> T = time.time()
> os.system('/opt/local/bin/dot -Tsvg -o test.svg graph.dot')
> print time.time() - T               #output here is 0.04 seconds
> T = time.time()
> os.system('pwd > testout.txt')
> print time.time() - T               #output here is 0.003 seconds
>
>
> Here's the CGI script:  run by navigating to the proper URL for the virtual host on my local machine
>
> ------test.cgi----------------
>
> #!/Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> import time
> import cgi, os
>
> print 'Content-Type: text/html; charset=utf-8\n\n'
> os.chdir('../../Temp')
> T = time.time()
> os.system('/opt/local/bin/dot -Tsvg -o test.svg graph.dot')
> print time.time() - T                 #output here is like 4 seconds
> T = time.time()
> os.system('pwd > testout.txt')
> print time.time() - T                #output here is 0.003 seconds
>
>
>
>
>

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux