473,837 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Services Shared Resource/Memory


How can I share resources across all users of a web service for read/write
access.

*Situation* *one*:

I want to have an in memory counter that all users of the webservice could
access. Call it g_count.

Then I create a web method called Update_g_count.

public int g_count( int incr )
{
g_count += incr;
return g_count;
}

So, how do I define g_count so it's global across all users?

*Situation* *two*:

I have an XML file that I want to load into an XmlDocument.

I want to set up a Web Method that uses XPath to find a node, and then
change the value of the InnerText.

How do I put this XmlDocument into memory so all users can update it without
collisions when they try to update the nodes?

Do I need to use a mutex ?

How can this mutex apply across all users of the web service ?

Do I put it in global.asax ?

--
incognito
http://kentpsychedelic.blogspot.com/
Nov 21 '05 #1
3 2808

That raises a lot of questions for me.

Just what is the potential of the XmlDocument class and XPath methods?

Are the numbers below based on fact, or just finger in the air estimates?

For example -- what is the performance of XPath on large XML documents.

For small documents, it seems lickety-split.

If an XmlDocument is implemented using a b-tree structure, then even for
very large numbers of records the speed of search should not increase by
much, right ?


Kondratyev Denis wrote:
Imho there is not "right" or "recomended " way for all situations. If your
xml document about 10-20 records storing in application object is good
idea. But if you have huge document with 10000 nodes you can store it in
DB. Or you can store data in DB if you data is VERY important and you want
it from server critical errors.

"Donnie Darko" <cu*****@vision s.cellar.door> ???????/???????? ? ????????
?????????: news:25******** ********@news.w est.earthlink.n et...

You say that this is not a 'recommended' way to share resources in web
applications.

Can you suggest a recommended way?

Specifically, I want to share access to an XmlDocument across all users
of
my web service. I want them to be able to query and update nodes on the
document.


--
incognito @ http://kentpsychedelic.blogspot.com/

Man is the best computer we can put aboard a spacecraft ... and the only one
that can be mass produced with unskilled labor. -- Werner von Braun
Nov 21 '05 #2
hi Donnie,

I'm not sure about the speed in the b-tree structure but i know that the memory consumption for XMLDocument is according to the following:

DOM and DataDOM overhead is per node. Node size is minimal .
- XmlNode: 4 bytes for parentNode
- +4 bytes for nodes that can have a next-sibling (which is prety much
everything)
- +4 bytes for nodes that have children - mostly XmlElement/XmlAttribute).
- + your data.

so maybe you can use this to calculate it? i also found the following KBs along the way and hope it might help you too.

INFO: Roadmap for Executing XPath Queries in .NET Applications
Article ID : 313828

INFO: Roadmap for XML in the .NET Framework
Article ID : 313651

HOW TO: Use the System.Xml.XmlD ocument Class to Run XPath Queries in Visual Basic .NET (317018)
PRB: XSL Transformations with XmlDataDocument May Perform More Slowly Than XPathDocument (318580)

Hope that helps,

Michelle

***Disclaimer: This posting is provided "as is" with no warranties and confers no rights.***
--------------------
Message-Id: <11************ ****@news.west. earthlink.net>
From: Donnie Darko <cu*****@vision s.cellar.door>
Subject: Re: Web Services Shared Resource/Memory

That raises a lot of questions for me.

Just what is the potential of the XmlDocument class and XPath methods?

Are the numbers below based on fact, or just finger in the air estimates?

For example -- what is the performance of XPath on large XML documents.

For small documents, it seems lickety-split.

If an XmlDocument is implemented using a b-tree structure, then even for
very large numbers of records the speed of search should not increase by
much, right ?


Kondratyev Denis wrote:
Imho there is not "right" or "recomended " way for all situations. If your
xml document about 10-20 records storing in application object is good
idea. But if you have huge document with 10000 nodes you can store it in
DB. Or you can store data in DB if you data is VERY important and you want
it from server critical errors.

"Donnie Darko" <cu*****@vision s.cellar.door> ???????/???????? ? ????????
?????????: news:25******** ********@news.w est.earthlink.n et...

You say that this is not a 'recommended' way to share resources in web
applications.

Can you suggest a recommended way?

Specifically, I want to share access to an XmlDocument across all users
of
my web service. I want them to be able to query and update nodes on the
document.


--
incognito @ http://kentpsychedelic.blogspot.com/

Man is the best computer we can put aboard a spacecraft ... and the only one
that can be mass produced with unskilled labor. -- Werner von Braun
Nov 23 '05 #3
Another aspect to consider is that there is no concurrency control when
you access an XmlDocument from multiple threads. You would have to
implement your own locking and possibly your own indexing if the
XPathDocument query speed isn't sufficient for you.

Any reasons you cannot store the data in a database (MSDE would be free,
SQL 2005 Express will be free and has great support for storing and
querying XML documents).

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

-----Original Message-----
From: Michelle Hlaing [mailto:i-****@online.mic rosoft.com]
Posted At: Tuesday, January 18, 2005 1:30 AM
Posted To: microsoft.publi c.dotnet.framew ork.webservices
Conversation: Web Services Shared Resource/Memory
Subject: Re: Web Services Shared Resource/Memory

hi Donnie,

I'm not sure about the speed in the b-tree structure but i know that the memory consumption for XMLDocument is according to the following:

DOM and DataDOM overhead is per node. Node size is minimal .
- XmlNode: 4 bytes for parentNode
- +4 bytes for nodes that can have a next-sibling (which is prety much
everything)
- +4 bytes for nodes that have children - mostly XmlElement/XmlAttribute). - + your data.

so maybe you can use this to calculate it? i also found the following KBs along the way and hope it might help you too.

INFO: Roadmap for Executing XPath Queries in .NET Applications
Article ID : 313828

INFO: Roadmap for XML in the .NET Framework
Article ID : 313651

HOW TO: Use the System.Xml.XmlD ocument Class to Run XPath Queries in
Visual Basic .NET (317018)
PRB: XSL Transformations with XmlDataDocument May Perform More Slowly Than XPathDocument (318580)

Hope that helps,

Michelle

***Disclaimer: This posting is provided "as is" with no warranties and
confers no rights.***
--------------------
Message-Id: <11************ ****@news.west. earthlink.net>
From: Donnie Darko <cu*****@vision s.cellar.door>
Subject: Re: Web Services Shared Resource/Memory

That raises a lot of questions for me.

Just what is the potential of the XmlDocument class and XPath methods?

Are the numbers below based on fact, or just finger in the air estimates?
For example -- what is the performance of XPath on large XML documents.
For small documents, it seems lickety-split.

If an XmlDocument is implemented using a b-tree structure, then even for very large numbers of records the speed of search should not increase by much, right ?


Kondratyev Denis wrote:
Imho there is not "right" or "recomended " way for all situations. If your
xml document about 10-20 records storing in application object is good
idea. But if you have huge document with 10000 nodes you can store it in DB. Or you can store data in DB if you data is VERY important and you want
it from server critical errors.

"Donnie Darko" <cu*****@vision s.cellar.door> ???????/???????? ?
???????? ?????????: news:25******** ********@news.w est.earthlink.n et...

You say that this is not a 'recommended' way to share resources in web applications.

Can you suggest a recommended way?

Specifically, I want to share access to an XmlDocument across all users of
my web service. I want them to be able to query and update nodes

on the document.

--
incognito @ http://kentpsychedelic.blogspot.com/

Man is the best computer we can put aboard a spacecraft ... and the

only one
that can be mass produced with unskilled labor. -- Werner von Braun

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
547
by: Grandpa Pete | last post by:
How can I share resources across all users of a web service for read/write access. *Situation* *one*: I want to have an in memory counter that all users of the webservice could access. Call it g_count. Then I create a web method called Update_g_count.
2
4475
by: Simon Lok | last post by:
Hi, Is there a distributed shared memory toolkit / API / SDK available for C#? I am looking for the C# equivalent of the JSDT (http://java.sun.com/products/java-media/jsdt/) where basically one has shared byte arrays across many JVMs. I guess I could "write it myself" by layering a token ring architecture over .NET remoting, but that would probably be more pain that it is worth... at least for me right now.
7
1643
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What are the implications, (in terms of memory, application footprint, resource use, threading, and so forth), of using Shared methods? These Shared classes raise some interesting questions. For example... (1). If I have a custom utility class where I keep all of my Shared methods
3
2360
by: Default User | last post by:
I work in software research and developement in the aerospace industry. We're assisting a project where they are interested in looking at web services in an embedded system. This would most likely be WSDL/XML/SOAP. While there would be fairly powerful processing to an extent, it's still a resource-constrained environment, running on an RTOS (I think VxWorks). In particular they are concerned about dynamic memory (don't like it). We're...
3
2539
by: Blubaugh, David A. | last post by:
To All, I was wondering if it was possible to utilize python to share a memory resource between a linux and windows system?? It should be stated that both the Linux (CENTOS 5) and windows are physically located on the same computer. Is any of this possible?
0
1525
by: Blubaugh, David A. | last post by:
Diez, What you have said is extremely concerning. I am now using VMware. With Linux as the Master and windows as the guest operating system. I was wondering if you have ever had to develop a share memory resource between Linux and windows within a Vmware setup?
0
9843
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10577
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5670
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5851
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.