| |
Datatables in Memory for Speed (ASP.Net)
Written by
Daniel Longieliere
Provided by Logic Unlimited
A while ago, while developing a flash based Mud code base using asp.net to manage the backend, I needed a way to store a large amount of data in RAM and keep it organized. I came up with using data tables, but storing them in an application variable to allow application level access to data in RAM. The results, Impressive speed and organized data.
Heres a brief run down on how to do it.
First, In Global.asax, define your data set, and assign it to an application level variable.
Second, in Global.asax, in the app_start section, define some startup functions to load whatever data you need to into the data table.
Third, access them as you would any data table, i.e. through your Application("whatever").tables("table_name").whatever
We use this on logicul.com in the creation of the articles section. There is no database that holds the articles index, it loads that all at startup by cycling through the files, and parsing the file names into sections to define them. In this way, we actually keep our articles indexed and organized without the use of a database. It's simpler, and more portable.
You can also use this in authentication as we have on some of our sites. In this way, you can authenticate a user near instantly without a hit to the database. In the sites we used it, we simply load the username, and the encrypted password (one way MD5) and the results are impressive.
At the time of writing this article, I have not coded to the login procedures, but most likely we will use this system on logicul.com. I may setup an example for you to try later on, if so Look back on this page for an update.
Also note, that while you probably do not want to load a huge amount of data into your memory based data tables, you do have the option. I have tested as high as 15,000 records with good sized rows (aprox 18 collumns). No hit to performance, and it was fast enough to store the entire world files of a stock circlemud.
I will soon be launching my asp.net circlemud project on logicul.com to hopefully get some interest in the idea and possibilities of asp.net. For those of you not in the know, circlemud was a telnet based game (all text) that I have recreated near flawlessly to run using flash, and no sockets. It needs a development team, so if you are interested in working on the project, please email me (daniel@logicul.com)
Did this help? If not,
click here and contact us for further
assistance.
|
|
|
 |
RECENT ARTICLES |
 |
|
| |
|
|
|
|
|