[thelist] Charting with Office Web Components (was my-platform-is-better...)

Jason Handby jasonh at corestar.co.uk
Thu Aug 19 11:21:09 CDT 2004


Hi Peter,


> 	Any idea of how scalable that solution would be?  I've 
> used Word as a spellchecker in C# winform apps -- docs suck 
> for that too -- but it seems like these office objects that 
> were built for single-threading might get choked on a web server.
> 	How has performance been for your app, and did you do 
> anything special to take the load off the OWC part?


Within my app, generating the main page with the charts on takes about 20
seconds to do. This is mainly because of what I have to do to the data
before charting it. So I was keen to find a way of reducing the number of
times I had to render the charts. Also I did have a concurrency issue,
caused by several people visiting the charting page at once. (The site is
often used as a discussion tool within groups of people, and they will
frequently move to the same page at the same time.)

I encapsulated my chart rendering code in an ASP.NET custom control. And
basically I do all the work in the Render() method. First I load up the OWC
with my data; then I save the chart out to a GIF file; finally I render the
custom control to the page as an <IMAGE> tag, with the SRC attribute
containing the URL of the GIF I've just saved.

I did my charts this way, rather than streaming the binary image data
directly, because it gave me a neat way of avoiding re-rendering charts that
hadn't changed. I added a timestamp field to the relevant data table in my
MS-SQL database, and created a new table to hold a record for each chart
including the date and time it was generated. So I compare timestamps, and
if the data hasn't changed since the GIF was rendered then I skip steps 1
and 2 in my Render() method and just render a link to the existing GIF file.
Not only do I not have to regenerate it, but the users browser may even have
cached the GIF from their previous visit so they might not even have to
download it.

Finally I did have to deal my concurrency problem by making sure that two
people don't check / re-render the same chart at the same time. I didn't
want to make the rendering code a critical section -- as far as I'm
concerned, multiple charts can be rendered at once provided they're not
several attempts to render the same chart -- so I had to implement my own
locking for it, driven by the unique identifier for the chart.

So I've allowed for several charts to be rendered at once in my server-side
code, but I don't know whether or not the OWC will allow that or whether
they're strictly single-threaded. I read that the 2000 OWC were flaky and
unstable for server-side solutions, partly because of their
single-threading. I also read that the XP OWC are more stable than the 2000
OWC; but whether or not they're still single-threaded isn't clear:

	http://support.microsoft.com/default.aspx?scid=kb;EN-US;317316

	http://195.186.84.74/xlimits/officewebcomponents.htm


HTH!





Jason



More information about the thelist mailing list