|
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.
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
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...
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|