|
||
|
|||||||
| Modification Suggestions This is where you can suggest a modifcation to RunUO! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#26 (permalink) |
|
Lurker
Join Date: Mar 2006
Posts: 18
|
The write/load of a save to a sql database is not very efficient.
The actual serialize/deserialize methods are much faster than a mysql server. Also much more reliable, cause if you first save to file and later to database you will have the two points of failure instead of one when only saving to file. And it is pointless to say you will not corrupt the whole save with sql because you should never trust a corrupted save. Just think about referential integrity. Another point is that if storing whole item information into one data row. You will violate first normal form in database normalization. So you will have to ask yourself why to use a database if you violate some of the basic rules. To store the world in an database only makes sense if you design the whole object model to it. Look at the commercial mmorpgs. They have server lines and big database clusters. And everything is designed to use the databases cause without them, they could not handle the server lines and transfer data from one shard to another. But RunUO is designed to handle one server and not a cluster. So if you want another storage engine, you have to take another approach in design. |
|
|
|
|
|
#27 (permalink) |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
The main point of this is mostly to make it so there are no world saves and for better redundancy (can use SQL replication). The actual process does take a bit longer especially if the SQL server is remote, but it is not seen by the users.
Also I can take a database snapshot at any given time to do real time backups. If I want I can pretty much back up hourly, or even every half hour. Later on I can seperate data from processing. So SQL would be it's own server and RunUO would be another server. Now you're right that it's best to design FOR that, but it would be easier to make an emulator from scratch at that point (thought of it, but I have no clue how to do the gzip packets) So I just kept the serialization method. There is still an advantage to that though and it's that each object is an individual entity. if something does corrupt for whatever reason, it won't involve the entire DB, just a small part of it. Also the file I mentioned is only if the server goes down. In normal circumstances it will never write to file.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
#28 (permalink) | |
|
Forum Expert
|
Quote:
The implied incosistency of your system introduces a lot of security holes, with a disasterous consequence.
__________________
Proudly ignorant, havoc we wreak. What is mem'ry and why does it leak?! |
|
|
|
|
|
|
#29 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
If something DOES go wrong, it won't affect the entire shard. There is still tons of testing left to do before this is considered production. Every possibility for stuff like SQL injection needs to be considered, and the proper order of queries is a must. There is also an issue where duplicate rows try to be entered and I think this is a result of a serial number being "freed" before the item using up that serial is removed from the DB, so I will need to fix that as well as it could cause issues. There's still stuff like this to fix, but once it'is 100% this system will be very solid and easier to manage compared to the old system. Players will also enjoy being able to play knowing their progress is saved in real time, and never have to wait after another save again. Save times are linear to the number of objects, so big shards get really big saves. Being in the middle of a dual and having to wait 10 seconds for a save is not cool.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
|
#30 (permalink) | |
|
Forum Expert
|
Quote:
You really don't need TONS of testing here, you write a byte - you read a byte, simple as that. Only people who are not aware of as to how the serialization system is working make mistakes here. With SQL it would be even worse: 1) SQL injection vulnerability 2) Reference incosistency 3) Overall throughput To use your words: If something DOES go wrong, then it IS YOUR FAULT (or whoever's who wrote the code), and the commons sense suggests that you SHOULD CRASH, time and again until the problem is fixed. It's like swallowing all exceptions and ignoring them, they have been thrown for a reason. Because of lack of a context, you can't have a global fault handler to save your ass, you'd need a fault handler for each type being saved/load, which is a lot of additional overhead.
__________________
Proudly ignorant, havoc we wreak. What is mem'ry and why does it leak?! Last edited by arul; 06-15-2009 at 11:10 PM. |
|
|
|
|
|
|
#31 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
Though having a whole system crash over an error that may not be fatal is not really a good approach. Why produce unneeded downtime? You don't see a race car driver quickly stop the car and quit if a tire is in dire need of change. He'll try to make it to the pit stop to have it fixed and continue the race.
__________________
Acronis :: Don't let data disasters kill you. Backup! Last edited by Acronis; 06-15-2009 at 11:38 PM. |
|
|
|
|
|
|
#32 (permalink) |
|
Master of the Internet
|
also from what i am reading here, i can see where this will bog down the more and more players, critters, etc that are on
each time something takes a step, it has to be saved, because of new location so a champ spawn with 200 critters spawned will be constantly updating those 200 critters to the database even if it is just x & y and maybe z -also direction too and that is just 1 champ spawn have 10 of those going plus the people at them so each hp change for all critters and players there, plus dura on equipment spells, timers, etc also all changing then you got all fo the other mobs walking around the world, vendors, etc each and every change of direction, step, etc all has to be saved on the fly it all sounds great, but i can see where you will be bogging yourself down constantly with all these things being saved continiously
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#33 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
I've been playing with different intervals to find out what is best. Right now only saves done within 5 seconds are resaved. The system can take care of about 9000 item changes/deletes/adds per second so far. Still need to optimize it a lot though.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
|
#34 (permalink) | |
|
Forum Expert
|
Quote:
Your system tries to take care of the effect, completely ignoring the cuase. Your comparison to Windows is another nonsense, unlike your thesis, the crucial part of windows - the kernel, works deterministically at all situations. If you somehow magically happened to delete a half of the windows registry the system wouldn't try to "accomodate", it'd simply crash. EDIT: Your comparison to a car driver is also wrong, the driver has no clue about the state of the tire, because the car already "fixed" it and only turned on the "Something bad happened" flash. If the error weren't fatal, then why it would have had crashed in the first place? The system entered an incosistent state, that which cannot be resolved without a human assistance, crashing is adequate.
__________________
Proudly ignorant, havoc we wreak. What is mem'ry and why does it leak?! Last edited by arul; 06-15-2009 at 11:51 PM. |
|
|
|
|
|
|
#35 (permalink) | |
|
Forum Novice
Join Date: Apr 2008
Posts: 283
|
Quote:
For example:
Things like this has always been a major issue for background saves ever since Sphere server because the server application has never been designed for background saves. How do you circumvent that problem?
__________________
I'm mainly using a modified RunUO 1.0 so any advice I give may need to be slightly adjusted. |
|
|
|
|
|
|
#37 (permalink) |
|
Forum Novice
Join Date: Apr 2008
Posts: 283
|
I guess we got your point and the point of all the others who criticized this way of storing. I too think that this is not a very practical approach but all the arguments have been presented and it should not be the purpose of this forum to evangelize people to one's own belief. I'm trying to learn something here that could be used for partial saves with the current save system. For example partial background saves every few minutes and a full foreground save every day or so to minimize a possible data loss and world save times. The problem is that I haven't figured out a clever way to avoid world save corruption when the world save takes place in the middle of an atomic transaction. The best solution would be to implement real atomic transactions but that would mean to completely rewrite large portions of the core.
__________________
I'm mainly using a modified RunUO 1.0 so any advice I give may need to be slightly adjusted. |
|
|
|
|
|
#38 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
|
#39 (permalink) |
|
Master of the Internet
|
how many items/mobiles are you doing your testing with?
because on a nearly empty shard - only a few 1000 things/critters, i have saves of .2 to .3 seconds so if your buffer is taking 1 seconds for a final flush, which is not even a complete hard save, it is either slower or ytou have to be having 10's of 1000' of thing in there so what i am saying, how many 100's of thousands of items/critters do you have in there? because if not that big of an amount to be testing with, then your saving times are a little big
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#40 (permalink) |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
The testing is being done with about 900k objects. To do a full save with the regular system it takes about 10 seconds of interruptd game play time. The SQL system never interrupts game play as it's done in another thread. Only the shard shut down takes about 1 sec as it stops all writes/activity and waits for buffer to catch up + waits for it to be written to DB (which normally happens in background).
I want to test with like 10 million objects later on. The speed is highly determined by the SQL server itself though. If I put on like raid 10 it would be super fast.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
#41 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 29
Posts: 6,078
|
Quote:
__________________
Jeff Boulanger ConnectUO - Creator/Core Developer ConnectUO Swag/Merchandise Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
|
#42 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
RAID 10 is usually the recommended configuration for DB servers. Raid 0 would be even faster but if a drive fails you're screwed. This is why it's unrealistic to depend on the DB being stored in ram. It gets written to disk often otherwise you'd end up with corrupted DBs when a server is shut down badly. (ex: pull the plug or power outage and no UPS). So you still need a very fast NVRAM for a SQL server. If I had the money I'd go with 15krpm SAS drives, but I will stick with sata. ![]()
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
|
#43 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 29
Posts: 6,078
|
Quote:
__________________
Jeff Boulanger ConnectUO - Creator/Core Developer ConnectUO Swag/Merchandise Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
|
#45 (permalink) |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Been progressing well. Some bugs here and there to fix, but otherwise working out well. There's a video here demonstrating the system in action.
The tricky part now is making sure that every item gets triggered to save when it's changed. In most cases I can call up the trigger in the get/set function (the set portion). For those who decide to try this, let me tell you, it's NOT easy! I fell totally behind with ML doing this but it will be worth it in the end. Then I have to code SA...lol
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
#46 (permalink) | |
|
Bug Hunter
|
Quote:
![]()
__________________
If you guys want ML, you are going to have to create it, submit it, and if it is good enough it will more than likely be added to the repository - Jeff |
|
|
|
|
|
|
#47 (permalink) | ||
|
RunUO Project Manager
Join Date: Jul 2004
Location: Harrison, OH
Age: 31
Posts: 3,910
|
Quote:
If you figure the amount of time you've spent putting this into MySQL and equate that to money you could buy some seriously good hardware and use that instead.. Another thing - Your information on the video: Quote:
When you're done with this - please by all means release it so that I can take a world like UOGamers Hybrid and show you just how much this would get crushed by 1,000+ players online, dynamic event systems, almost 18 million items, almost 1 million mobiles and 250,000 accounts with anywhere from 20 - 30% of them being active daily.
__________________
Ryan McAdams RunUO Team - Project Manager |
||
|
|
|
|
|
#48 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
As my system uses more ram to buffer the SQL statements, my biggest challenge is overcoming the .NET memory limitation. A .NET app will crash with OutOfMemoryExeption when it starts to use too much ram regardless of what is left on the system. Normally anything past 2GB and it crashes but it's hit and miss. I need to test this on a 64-bit platform as I'm hoping this limitation does not exist there.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
|
|
#49 (permalink) |
|
Forum Expert
|
Code:
public override void InvalidateProperties()
{
_SaveRequired = true;
base.InvalidateProperties();
}
It would be much faster to create your own storage system, or use the existing system with more care :/ Do you plan on using multi-threading with this system?
__________________
Criticism should not be the cause of anger. -Dominik Seifert
Last edited by Vorspire; 11-01-2009 at 03:07 AM. |
|
|
|
|
|
#50 (permalink) | |
|
Forum Novice
Join Date: Nov 2008
Age: 23
Posts: 199
|
Quote:
And yeah it is multithreaded. The way it works is every 10 secs or so all flagged items are "saved" in a memory buffer. this is where the SQL statements are made and put in a string. The items are then unflagged. This happens in a fraction of a second as iterating through a dictionary containing only changed items and creating the strings is rather fast. This then tells the SQL thread that it can now proceed to save to SQL. At this point the world continues to function and the SQL save thread now reads through the buffer, and writes to the DB. During this time no buffer save can happen so modified items just accumulate as they change. When an item is flagged it's also put into a separate dictionary. If I wanted to I could have a separate thread for Item, Mobile, Guild and Account but I chose not to as I don't think it's needed. Still some tweaking to be done though. If I tile 500 DFs then tile another 500 DFs with a different team, they all fight each other and it really lags up. I need to find a code profiler for C# that's free so I can find out what is the biggest slow down in my system.
__________________
Acronis :: Don't let data disasters kill you. Backup! |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|