Please check out A Merging of Fates !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Loading everything into memory? Mon Jan 11, 2010 [10:28 AM]
Viriato
Email not supplied
member since: Jun 9, 2006
Reply
Good evening.
Every MUD engine, when run, will load everything into memory?
A MUD with 20k rooms, 20k NPC, 20k items and 200 players, has 20k + 20k + 20k + 200 objects in memory?
Thanks in advance
Viriato

#### Iberia MUD ####
iberiamud.com:5900
www.iberiamud.com


2. RE: Loading everything into memory? Mon Jan 11, 2010 [11:50 AM]
KaVir
Email not supplied
member since: Aug 19, 1999
In Reply To
Reply
> Every MUD engine, when run, will load everything into
> memory?

No.
God Wars II: http://www.godwars2.org (godwars2.org 3000) Roomless world. Manual combat. Endless possibilities.
MudLab: http://www.mudlab.org


3. RE: Loading everything into memory? Mon Jan 11, 2010 [12:09 PM]
Viriato
Email not supplied
member since: Jun 9, 2006
In Reply To
Reply
Can tell me your muds example, or how standard muds load data?
Viriato

#### Iberia MUD ####
iberiamud.com:5900
www.iberiamud.com


4. RE: Loading everything into memory? Mon Jan 11, 2010 [12:25 PM]
KaVir
Email not supplied
member since: Aug 19, 1999
In Reply To
Reply
There's no real "standard", there are many approaches (just as there are many types of mud). Some muds load everything in advance, some load (and unload) varying amounts of their game data on the fly as needed, some use a database management system to handle the caching for them, etc.

There's no universal right or wrong way to do it, it depends on the specifics of your game - and as there are many types of mud, so there are many solutions out there.
God Wars II: http://www.godwars2.org (godwars2.org 3000) Roomless world. Manual combat. Endless possibilities.
MudLab: http://www.mudlab.org


5. RE: Loading everything into memory? Mon Jan 11, 2010 [12:32 PM]
scandum
Email not supplied
member since: Aug 30, 2002
In Reply To
Reply
Modern muds load everything into memory.

Some older muds still load rooms and other things from the hard disk, they have the tendency to go down every 2 or 3 years due to a malfunctioning hard disk.

Some modern muds have gone backwards as well using databases, which are generally disk based.
http://tintin.sf.net - Kickin It Old Skool since 1992


6. RE: Loading everything into memory? Mon Jan 11, 2010 [12:33 PM]
Viriato
Email not supplied
member since: Jun 9, 2006
In Reply To
Reply
Ok, thank you.
Another question, please: in order to increase performance, and having entire MUD data in a DB (managing it with SQL), it is better to load pieces of data into memory variables (like characters data) and save it in DB from times to times (and when needed), or work directly in the DB, considering it is always open?
Viriato

#### Iberia MUD ####
iberiamud.com:5900
www.iberiamud.com


7. RE: Loading everything into memory? Mon Jan 11, 2010 [1:11 PM]
mann_jess
Email not supplied
member since: Dec 10, 2005
In Reply To
Reply
in order to increase performance, and having entire MUD data in a DB (managing it with SQL), it is better to load pieces of data into memory variables...or work directly in the DB, considering it is always open?

As KaVir pointed out, this will depend on your particular environment. You should run benchmarks to figure out which will work best for you; Test how long it takes to load an item from the DB into memory, and weigh that against the cost of keeping the item in memory.

As a general rule, storing it in memory will always be faster than loading from the DB, so store whatever you have room for in memory, and cache the rest in the DB to be loaded on-demand.

Best of Luck,
-Jess


8. RE: Loading everything into memory? Mon Jan 11, 2010 [3:38 PM]
Jindrak
Email not supplied
member since: Jun 9, 2002
In Reply To
Reply
> As a general rule, storing it in memory will always be faster than
> loading from the DB, so store whatever you have room for in memory, and
> cache the rest in the DB to be loaded on-demand.


You will also want to factor in how often you need to access the memory. A couple of examples for my Mud would be the victory code which stores Player-Kill victories/defeats and my channel history. In my opinion there is no need to waste excess memory on storing those items and can be saved/loaded directly to the MySQL database when needed...
Legends of Hatred:
telnet://www.godwars.net:3500

GodWars: Legends (Upcoming GodWars 1996 Pure-PK):
http://www.facebook.com/CoC.Mud


9. RE: Loading everything into memory? Tue Jan 12, 2010 [9:55 AM]
Viriato
Email not supplied
member since: Jun 9, 2006
In Reply To
Reply
Thank you for the answers and tips
Viriato

#### Iberia MUD ####
iberiamud.com:5900
www.iberiamud.com


10. RE: Loading everything into memory? Tue Jan 12, 2010 [8:31 PM]
Pymeus
Email not supplied
member since: Oct 3, 2008
In Reply To
Reply
Cramming everything into memory is certainly faster and easier.

The main reason some muds "lazy load" is the low memory capacity of the machines they were developed for 15+ years ago. By modern standards, nearly all existing muds use a pitifully small amount of memory. 1% to 3% usage is probably a good estimate on a new home desktop system. The few hundred thousand lines of descriptive text a large mud might have is small compared to, say, one average youtube video. Of course, exceptions are out there.

Databases are slower, but used properly can offer advantages in terms of data integrity and persistence.
Adventures Unlimited
connect: tharel.net 5005
website: http://www.tharel.net/
flash: http://mudgamers.com/home/client/?host=tharel.net&port=5005


11. RE: Loading everything into memory? Wed Jan 13, 2010 [2:53 AM]
KaVir
Email not supplied
member since: Aug 19, 1999
In Reply To
Reply
> Cramming everything into memory is certainly faster and easier.

From an implementation perspective, perhaps. But in terms of performance, lazy initialisation allows the mud to spread out the loading effort. This can have a noticable impact on things like hotreboot/copyover, if you use such a feature.

It's also worth noting that while modern computers tend to have far more memory than most muds need, if you're using a mud hosting service then even a few extra MB will increase your monthly fee.
God Wars II: http://www.godwars2.org (godwars2.org 3000) Roomless world. Manual combat. Endless possibilities.
MudLab: http://www.mudlab.org


12. RE: Loading everything into memory? Wed Jan 13, 2010 [2:17 PM]
Tyche
Email not supplied
member since: Apr 4, 2000
In Reply To
Reply
Some muds are configurable so they run with everything in memory or run in a small memory space loading from disk as needed. The more interesting question is what you save, when you save and how you save it.
The Sourcery - http://sourcery.dyndns.org
TeensyMud - http://teensymud.kicks-ass.org
"A man can receive nothing, except it be given him from heaven."


13. RE: Loading everything into memory? Wed Jan 13, 2010 [5:23 PM]
cratylus
Email not supplied
member since: Feb 1, 2006
In Reply To
Reply

Modern muds load everything into memory.


Modern LP muds do not usually load everything into memory.

-Crat
http://lpmuds.net




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]