Commit graph

5 commits

Author SHA1 Message Date
Mag-nus
75fc1ce23c
Step 3. Convert ShardDatabase/WorldObjects biota from the ACE.Database model to the new ACE.Entity model (#2731)
* Step 1. Add new adapter classes and models

All classes and objects added are in new namespaces.

This add has 0 interraction on existing ACE code.

This sets the groundwork for Step 2. Moving World DB caching to the new models

* first part of the world entity usage

* almost there

* final part

* update WeenieExtensions

* fix

* merge fixes and improvements

* ACE.Database new code

* it compiles

* InitializePropertyDictionaries

* WOrldDatabaseWithEntityCache cleanup

* ShardDatabaseWithCaching

* ShardDatabase Cleanup

* todo

* cache counts reported in serverstatus

* House InitializePropertyDictionaries

* improve ServerStatus

* BiotaModel change HousePermissions to Dictionary<uint, bool>

* PropertiesAllegiance to dictionary

* BiotaUpdater improvements

* Shard Database Cache Reporting

* More code ported from Step 3

* Remove stub CharacterCache

* Update WorldDatabaseWithEntityCache.cs

* build fixes

* code audit

* Remove non-callback functions from SerializedShardDatabase

* BiotaUpdater progress.. only emote left

* Emotes done... now need to test

* fix

* Burden/Value fix for containers

* fat fingered EncumbranceVal

* add some safety

* Don't cache player biotas for initial PlayerManager load

* fix null spellbook

* Add another null check

This is redundant as the check is also upstream.

This is to prevent an exception in the future if this function is called from another source.
2020-04-02 22:40:27 -05:00
Mag-nus
118c890285 More profiling based improvements (#1067)
* RateMonitor created

* NetworkSession Update foreach change to help profiling

This just removes the lambda pattern for the foreach so profilers can monitor each line individually.

Functionality is unchanged.

* Reduce Landblock ctor async work to a single thread

This helps reduce ACE thread starvation

* NetworkSession cosmetic

* NetworkSession cosmetic

* NetworkSession currentBundles ConcurrentDictionary to Array

This significantly improves the performance of NetworkSession.

Arrays are faster than Dictionaries, and we manage concurrency to the elements via currentBundleLocks.

We're also able to get away with using an array because the number of elements is only 12.

Accessing the indexes of currentBundles should be atomic as it's an array of reference values, compiled as 64 bit.

* Add InParallel to database functions that do their underlying work in parallel

* DoSessionWork tick outbound messages in series, not in parallel.

* NetworkSession should not be interfacing with ActionChains

* Don't load landblock ctor resources in parallel

Save the threads in the pool for more important work

* LandblockManager removed check/recheck

This is legacy code from a pattern no longer used. It is no longer required.

* Cosmetic
2018-10-15 23:06:54 -04:00
Mag-nus
3232074f90
CommandHandlerHelper (Yum!) Added (#1027)
There were a ton of commands that worked both on the console, and from a player session.

These commands had conditions like the following to determine if the output should be sent to the console or to the sesion:
if (session != null)
 sendToSession()
else
 SendToConsole()

CommandHandlerHelper cleans up this.

In addition, there were places in the code that were doing Console.WriteLine that should have been using the logger instead.
2018-09-24 07:04:58 -05:00
Mag-nus
12c9eea68a
Shard Biota Save & Threading Model Rework (#960)
* SaveBiota major changes

SaveBiota now only updates values in the database that have changed instead of updating every single value.

In addition. SaveBiota detects added and removed linked entities.

* Replace AddBiota(s) with SaveBiota(s)

* This improves the way a few places referenced the biota

* SaveBiota switched to a diff method. Still some work to do

* More notes + fixes

* SaveBiota move GetBiota to before EnterWriteLock

* Added a note about the lock performance

* More summary improvements for BiotaDatabaseLock

* Thread safety added to the SaveBiotas and AddBiotas functions

SavePlayer also switched to use the SaveBiotas bulk action instead of saving each biota individually.

* Biota.Clone() added

* BiotaExtensions cosmetic only

* DbUpdateException fixed

If there were multiple new records in a collection, the first one was attached but with the last new records values.

This would end up resulting in property records with duplicate types id's.

* ReoveBiota check if biota actually exists in db before removal.

* /databasequeueinfo added

* New From-Weenie Containers should not be searching the shard for inventory

* DeveloperDatabaseCommands removed RequiresWorld flag

* Improved DatabasePerfTest results.
2018-08-20 18:30:38 -05:00
Mag-nus
9622ab3f61
DatabasePerfTest developer command added (#957)
My test results:

Starting Database Performance Tests.
Biotas per test: 1000
This may take several minutes to complete...
1000 individual add   . Duration:  29.9 seconds. Successes: 1000, Failures:    0. Average:  30 ms
1000 individual save  . Duration:  23.9 seconds. Successes: 1000, Failures:    0. Average:  24 ms
1000 individual remove. Duration:  23.7 seconds. Successes: 1000, Failures:    0. Average:  24 ms
1000 bulk add         . Duration:   8.5 seconds. Successes:    1, Failures:    0. Average:   9 ms
1000 bulk save        . Duration:   6.2 seconds. Successes:    1, Failures:    0. Average:   6 ms
1000 bulk remove      . Duration:   7.0 seconds. Successes:    1, Failures:    0. Average:   7 ms
Database Performance Tests Completed

Next step is to modify the save to detect added/removed entities and only update changed records (not all).
2018-08-18 09:35:26 -05:00