Django HttpResponse performance with mimetype=application/atom+xml or text/xml

133 views
Skip to first unread message

serjant

unread,
Mar 29, 2010, 11:21:47 AM3/29/10
to Django users
Hi all.

Can somebody help me and point me to solving the following problem:

1. I am writing an application where I render the needed information
in the XML file (to be more specific GeoRSS)
2. I am generating the GeoRSS with the means of the GeoAtom1RSS django
class, and passing it to HttpResponse in this way:

response = HttpResponse(mimetype='application/atom+xml')
geoFeed.write(response, encoding) #geoFeed is the generated GeoRSS
return response

So the problem is time rendering of this XML file in browser. When I
want to see the generated RSS or XML in borwser, then the rendering is
too slow, takes at least 25-40 seconds.
I wrote a TestCase, where i found that the generator is not to blame
at all, cuz selecting data from the database and generating GeoRSS
with it takes 2-3 seconds maximum (avg: 1.5 seconds) in case the data
is so huge.
By switching the mimetype to text/html, the performance was really
good and stopped at 3 seconds of the rendering.

Is there any way to increase the speed of the GeoRSS or XML rendering
with HttpResponse?
Is that a known issue?

Thanks in advance
David

Dan Carroll

unread,
Mar 30, 2010, 3:44:37 PM3/30/10
to Django users
How big is the XML? Since you've already verified that the generation
isn't the problem, this could be a browser issue. Most browsers
attempt to parse and style the XML (to show it in a nice document
tree), which could take a while for really huge files. When choosing
to output with the HTML mimetype, the browser doesn't need to do any
extra work.

Vinuta Shetty

unread,
May 10, 2012, 2:42:21 PM5/10/12
to django...@googlegroups.com
Was your issue resolved? I am having a similar problem. I am rendering a PDF document and it takes forever. Not sure why?
Reply all
Reply to author
Forward
0 new messages