local XML file or trip to SQL DB?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngarchitecture' list.


Francesco Sanfilippo
Which is faster: reading and writing to and from a tiny XML file on the web
server, or reading and writing to and from the SQL DB on the same box as the
web server?

The purpose is to simulate IIS Logging, but with some custom items I need.
I don't wantto make a trip to the DB every click of every user. I think it
would be better to accumulate the strings somewhere faster, and every 15
minutes or so, dump it to SQL.

Francesco

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

Reply to this message...
 
    
Tim Royal
If I were you, and I wanted to track that kind of activity, I'd look into
having an application scope class with a static method (and static
StringBuilder object), and just append a list of data to that on each
request. Maybe run a process that dumps it to a database every X minutes.
THe only thing I can think of that may be an issue is the concurrency issue,
but then you have that with file read/writes anyway (something you'd be
assured of not happening with directly inputting your info into SQL).

In reality, you could do start off by writing the process to hit SQL Server
and see if it can handle the load you anticipate. If not, you try the other
approaches next (since you'll need the SQL Server anyway to do the batch
uploads, you won't lose much, if any, work in doing the Direct to SQL Server
approach).

Tim

->-----Original Message-----
->From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
->Sent: Thursday, June 06, 2002 3:45 PM
->To: aspngarchitecture
->Subject: [aspngarchitecture] local XML file or trip to SQL DB?
->
->
->Which is faster: reading and writing to and from a tiny XML
->file on the web
->server, or reading and writing to and from the SQL DB on the
->same box as the
->web server?
->
->The purpose is to simulate IIS Logging, but with some custom
->items I need.
->I don't wantto make a trip to the DB every click of every
->user. I think it
->would be better to accumulate the strings somewhere faster,
->and every 15
->minutes or so, dump it to SQL.
->
->Francesco
->
->_________________________________________________________________
->Get your FREE download of MSN Explorer at
->http://explorer.msn.com/intl.asp.
->
->
->| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
->| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
->| http://www.asplists.com/search = SEARCH Archives
->
->
->

Reply to this message...
 
    
Dan Wahlin
You can find a simple comparison test at the following URL:

http://www.xmlforasp.net/codeSection.aspx?csID=5

Although not scientific, you can get a general idea about how different
XML parsing techniques compare with hitting a db. The source code is
available so you can tweak things as needed.

HTH,
Dan Wahlin

Wahlin Consulting LLC
Microsoft MVP - ASP.NET
http://www.XMLforASP.Net: #1 ASP.NET XML Resource
XML for ASP.NET Developers by Dan Wahlin in bookstores everywhere!

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
Sent: Thursday, June 06, 2002 3:45 PM
To: aspngarchitecture
Subject: [aspngarchitecture] local XML file or trip to SQL DB?

Which is faster: reading and writing to and from a tiny XML file on the
web
server, or reading and writing to and from the SQL DB on the same box as
the
web server?

The purpose is to simulate IIS Logging, but with some custom items I
need.
I don't wantto make a trip to the DB every click of every user. I think
it
would be better to accumulate the strings somewhere faster, and every 15

minutes or so, dump it to SQL.

Francesco

_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.

| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Russ McClelland
SSB3YXMgdGhpbmtpbmcgdGhlIHNhbWUgdGhpbmcgb25seSBoYXZpbmcgdGhlIHRyYWNlIGV2ZW50
cyBhdXRvbWF0aWNhbGx5DQpsb2dnZWQgd2hlbiB0aGUgc2Vzc2lvbiBjbG9zZWQvdGVybWluYXRl
ZC4gIEF2b2lkcyB0aGUgbmVlZCBmb3IgY29kZSB0bw0KY2hlY2sgdGltZSBpbnRlcnZhbHMgb3Ig
ZXZlbnQgdGhyZXNoaG9sZHMgKGV0Yy4pIGZvciBzaW1wbGljaXRpZXMgc2FrZS4NCkkgZG91YnQg
eW91IHdvdWxkIGxvc2UgdG9vIG1hbnkgc2Vzc2lvbnMgaW4gYSB3YXkgdGhhdCB3b3VsZG4ndCBn
ZXQNCmNsZWFuZWQgdXAgZmlyc3QuDQoNCgktLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS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Q0KCQ0KDQo
Reply to this message...
 
    
Mark Feinholz
If you were to manage this in memory, with an object scoped to the
application level, and wanted to make sure that that object got
persisted to disk (either to a db or a file) every 5 minutes or so, what
techniques are available for making sure that every 5 minutes some
thread wakes up and dumps the application object to disk?

In other words, how do you set up a thread that wakes up every 5 minutes
and has access to the Application object?

Mark.

-----Original Message-----
From: Tim Royal [mailto:Click here to reveal e-mail address]
Sent: Thursday, June 06, 2002 9:03 PM
To: aspngarchitecture
Subject: [aspngarchitecture] RE: local XML file or trip to SQL DB?

If I were you, and I wanted to track that kind of activity, I'd look
into
having an application scope class with a static method (and static
StringBuilder object), and just append a list of data to that on each
request. Maybe run a process that dumps it to a database every X
minutes.
THe only thing I can think of that may be an issue is the concurrency
issue,
but then you have that with file read/writes anyway (something you'd be
assured of not happening with directly inputting your info into SQL).

In reality, you could do start off by writing the process to hit SQL
Server
and see if it can handle the load you anticipate. If not, you try the
other
approaches next (since you'll need the SQL Server anyway to do the batch
uploads, you won't lose much, if any, work in doing the Direct to SQL
Server
approach).

Tim

->-----Original Message-----
->From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
->Sent: Thursday, June 06, 2002 3:45 PM
->To: aspngarchitecture
->Subject: [aspngarchitecture] local XML file or trip to SQL DB?
->
->
->Which is faster: reading and writing to and from a tiny XML
->file on the web
->server, or reading and writing to and from the SQL DB on the
->same box as the
->web server?
->
->The purpose is to simulate IIS Logging, but with some custom
->items I need.
->I don't wantto make a trip to the DB every click of every
->user. I think it
->would be better to accumulate the strings somewhere faster,
->and every 15
->minutes or so, dump it to SQL.
->
->Francesco
->
->_________________________________________________________________
->Get your FREE download of MSN Explorer at
->http://explorer.msn.com/intl.asp.
->
->
->| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
->| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
->| http://www.asplists.com/search = SEARCH Archives
->
->
->

| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
mail
Not everything that glitters is gold!!!!!!!!

I saw a very interesting conversation between Paul Flessner (Vice
Presidente de SQL Server y Middleware), Joe Long (Group Manager de COM+)
y Robert Hess (Product Manager para Microsoft y presentador del .NET
Show).
Here they talk about this issue and I agree with them

http://msdn.microsoft.com/theshow/Viewer/player.asp?
folder=Episode003&file=56k.asx

-----Original Message-----
From: "Francesco Sanfilippo" <Click here to reveal e-mail address>
To: "aspngarchitecture" <Click here to reveal e-mail address>
Date: Thu, 06 Jun 2002 15:45:19 -0700
Subject: [aspngarchitecture] local XML file or trip to SQL DB?

[Original message clipped]

Reply to this message...
 
    
Ben Hyrman
Have you considered firing off events in response to user actions you want
to record? These could be fired asyncronously (no noticable overhead to the
user) and then recorded to the storage structure of your choice by a
listener. Basically, record to a queue, read from a queue. This is how many
of the app servers I've worked with have handled your problem.

Ben

----- Original Message -----
From: "Francesco Sanfilippo" <Click here to reveal e-mail address>
To: "aspngarchitecture" <Click here to reveal e-mail address>
Sent: Thursday, June 06, 2002 3:45 PM
Subject: [aspngarchitecture] local XML file or trip to SQL DB?

> Which is faster: reading and writing to and from a tiny XML file on the
web
> server, or reading and writing to and from the SQL DB on the same box as
the
[Original message clipped]

Reply to this message...
 
 
System.Text.StringBuilder




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com