G
Guest
Hi all, I've just finished writing a website using aspx pages (with VB behind) and it seems
to be working adequately, except that I anticipate that it will become fairly slow as the
number of concurrent users (up to possible 1000) start using it - no surprise. However, now
my job is to try to ensure the efficiency of the code before it is deployed
The foundation of the entire site is the use of XMl files that are being formatted using
XSL
Likely the greatest cost (in terms of processing) is reading the XML files into memory (the
XSL files are VERY small compared to the XML files so I'm not as worried about reading them
in). Some of the XML files are a few megabytes large and if they are getting loaded by
hundreds of different users, that is likely going to not only use a significant amount of
memory, but it is also going to have the code loading the same file multiple times
I was thinking about using the Singleton pattern to encapsulate a XPathDocument, but noticed
this on the Microsoft site concerning the XPathDocument
"Any public static (Shared in Visual Basic) members of this type are thread safe. Any
instance members are not guaranteed to be thread safe.
Now I suppose that I could wrap the entire class in a class that extends XPathDocument and
ensure the synchronization of each of the instance functions, but then the bottleneck would
be accessing the methods of the XPathDocument object
Does anyone have any suggestions on how to make this site more efficient? Are there
commonly used design patterns when using the objects of type
XPathDocumen
XslTransfor
Specifically when using XPathDocument's
constructor with a String paramete
CreateNavigator Functio
AND specifically when using XslTransform's
- default constructo
- Load Function with String paramete
- One of the following forms of the Transform Sub
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, Stream, XmlResolver
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, TextWriter,
XmlResolver
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, XmlWriter,
XmlResolver
- There are 3 additional overloads, only difference is IXPathNavigable is XPathNavigabl
The above procedures belonging to each of the two classes are the majority of the
functionality that my site is providing (the workhorse of the site if you will). There are
some other bits of functionality that I've provided, but of much less consequence
Thanks
Novic
PS Is any one of the three Transform Sub's any more efficient than any of the others? I've
experimented with all three and noticed no functional difference - i.e.
1
Dim xmlWriter As XmlTextWriter = New XmlTextWriter(Response.OutputStream,
System.Text.Encoding.UTF8
xslTransform.Transform(doc, arguments, xmlWriter, Nothing
2
Dim writer As System.IO.StreamWriter = New StreamWriter(Response.OutputStream
xslTransform.Transform(doc, arguments, writer, Nothing
3
xslTransform.Transform(doc, arguments, Response.OutputStream, Nothing
to be working adequately, except that I anticipate that it will become fairly slow as the
number of concurrent users (up to possible 1000) start using it - no surprise. However, now
my job is to try to ensure the efficiency of the code before it is deployed
The foundation of the entire site is the use of XMl files that are being formatted using
XSL
Likely the greatest cost (in terms of processing) is reading the XML files into memory (the
XSL files are VERY small compared to the XML files so I'm not as worried about reading them
in). Some of the XML files are a few megabytes large and if they are getting loaded by
hundreds of different users, that is likely going to not only use a significant amount of
memory, but it is also going to have the code loading the same file multiple times
I was thinking about using the Singleton pattern to encapsulate a XPathDocument, but noticed
this on the Microsoft site concerning the XPathDocument
"Any public static (Shared in Visual Basic) members of this type are thread safe. Any
instance members are not guaranteed to be thread safe.
Now I suppose that I could wrap the entire class in a class that extends XPathDocument and
ensure the synchronization of each of the instance functions, but then the bottleneck would
be accessing the methods of the XPathDocument object
Does anyone have any suggestions on how to make this site more efficient? Are there
commonly used design patterns when using the objects of type
XPathDocumen
XslTransfor
Specifically when using XPathDocument's
constructor with a String paramete
CreateNavigator Functio
AND specifically when using XslTransform's
- default constructo
- Load Function with String paramete
- One of the following forms of the Transform Sub
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, Stream, XmlResolver
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, TextWriter,
XmlResolver
- Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, XmlWriter,
XmlResolver
- There are 3 additional overloads, only difference is IXPathNavigable is XPathNavigabl
The above procedures belonging to each of the two classes are the majority of the
functionality that my site is providing (the workhorse of the site if you will). There are
some other bits of functionality that I've provided, but of much less consequence
Thanks
Novic
PS Is any one of the three Transform Sub's any more efficient than any of the others? I've
experimented with all three and noticed no functional difference - i.e.
1
Dim xmlWriter As XmlTextWriter = New XmlTextWriter(Response.OutputStream,
System.Text.Encoding.UTF8
xslTransform.Transform(doc, arguments, xmlWriter, Nothing
2
Dim writer As System.IO.StreamWriter = New StreamWriter(Response.OutputStream
xslTransform.Transform(doc, arguments, writer, Nothing
3
xslTransform.Transform(doc, arguments, Response.OutputStream, Nothing