Commit Graph

214 Commits (58c260140ccd15846700f01cceb7b08d87df144e)

Author SHA1 Message Date
John Hurliman 59eb378d16 Small performance tweaks to code called by the heartbeat loop 2009-10-28 23:10:16 -07:00
John Hurliman a069a1ee68 Limit physics time dilation to 1.0 2009-10-28 14:44:05 -07:00
John Hurliman 0c466b28bb Move the calculation of time dilation from the scene to the physics engine. The scene is still the one reporting dilation so this does not break the API or remove flexibility, but it gets the calculation happening in the right place for the normal OpenSim usage. The actual calculation of physics time dilation probably needs tweaking 2009-10-27 16:24:43 -07:00
John Hurliman a718d7d56a Making the defaults for interest management variables match whether you have the [InterestManagement] section in your config or not 2009-10-27 10:17:20 -07:00
John Hurliman bcd7593dfb Forgot a line in the previous commit 2009-10-27 10:07:35 -07:00
John Hurliman 3a1ee79ee4 Finally hunted down the Parallel deadlock. Packets were being handled asynchronously (filling up the threadpool with handlers), which would turn around and try to do parallel operations on the starved threadpool. The solution for now is to disable Parallel.cs operations until we can gracefully handle parallel operations with a potentially starved threadpool 2009-10-27 02:36:57 -07:00
John Hurliman d199767e69 Experimental change of PhysicsVector to Vector3. Untested 2009-10-26 18:23:43 -07:00
John Hurliman 0b1726b524 Removing the ClientManager reference from IScene and hiding it entirely inside Scene as an implementation detail. This will reduce programming error and make it easier to refactor the avatar vs client vs presence mess later on 2009-10-26 16:48:43 -07:00
John Hurliman 4847e62e9f * Switched all operations on the list of clients that could be either sync or async to use Scene.ForEachClient() instead of referencing ClientManager directly
* Added a new [Startup] config option called use_async_when_possible to signal how to run operations that could be either sync or async
* Changed Scene.ForEachClient to respect use_async_when_possible
* Fixing a potential deadlock in Parallel.ForEach by locking on a temporary object instead of the enumerator (which may be shared across multiple invocations on ForEach). Thank you diva
2009-10-26 16:33:04 -07:00
John Hurliman 119cf80e13 Added calls to GC.AddMemoryPressure() when unmanaged memory is allocated for ODE (helps the GC make better scheduling choices), and a call to GC.Collect() right before logins are enabled for a region. Although this doesn't change actual memory usage, it improves the reported usage from OpenSim and the operating system 2009-10-26 15:52:59 -07:00
John Hurliman ac7ccdf7d7 * Changed the watchdog timer to improve the speed of UpdateThread(), only track threads once the first call to UpdateThread() has been made, and allow re-tracking of threads that timed out but revived later
* Added a commented out call to Watchdog.UpdateThread() in OdeScene. If it turns out that loading a large OAR file or some other operation is timing out the heartbeat thread, we'll need to uncomment it
2009-10-26 14:41:27 -07:00
John Hurliman 730930955a Changing Scene.ForEachClient to use the synchronous for loop instead of Parallel. This is quite possibly the source of some deadlocking, and at the very least the synchronous version gives better stack traces
* Lock the LLUDPClient RTO math * Add a helper function for backing off the RTO, and follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR values during a backoff

* Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape()

* Improved the instantiation of PrimitiveBaseShape
2009-10-25 00:40:21 -07:00
John Hurliman 2c34619aea * Changed various modules to not initialize timers unless the module is initialized. Ideally, the timers would not initialize unless the module was actually enabled, but Melanie's work on configuring module loading from a config file should make that unnecessary
* Wrapped the Bitmap class used to generate the world map tile in a using statement to dispose of it after the JPEG2000 data is created
2009-10-23 14:22:21 -07:00
John Hurliman a41cd1d069 * Unregister Mono.Addins event handlers in PluginLoader.Dispose() and always handle PluginLoader with the using pattern. This freed up 121,634,796 bytes on my system
* Avoid allocating an Action<IClientAPI> object every round of the OutgoingPacketHandler
* Removed unnecessary semi-colon endings from OpenSim.ini.example [InterestManagement] section
2009-10-23 13:14:29 -07:00
John Hurliman 62f1a5e36d Implemented a "FrontBack" prioritizer, using distance plus the plane equation to give double weight to prims/avatars in front of you 2009-10-23 02:38:59 -07:00
John Hurliman 588361e2a2 Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed 2009-10-23 01:02:36 -07:00
John Hurliman b2ed348aa2 Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated 2009-10-22 12:33:23 -07:00
Melanie c4969d47d9 Merge branch 'master' into vehicles 2009-10-22 07:12:10 +01:00
John Hurliman bd03cbd815 Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into prioritization 2009-10-19 15:19:37 -07:00
John Hurliman 142008121e * Change Util.FireAndForget to use ThreadPool.UnsafeQueueUserWorkItem(). This avoids .NET remoting and a managed->unmanaged->managed jump. Overall, a night and day performance difference
* Initialize the LLClientView prim full update queue to the number of prims in the scene for a big performance boost
* Reordered some comparisons on hot code paths for a minor speed boost
* Removed an unnecessary call to the expensive DateTime.Now function (if you *have* to get the current time as opposed to Environment.TickCount, always use DateTime.UtcNow)
* Don't fire the queue empty callback for the Resend category
* Run the outgoing packet handler thread loop for each client synchronously. It seems like more time was being spent doing the execution asynchronously, and it made deadlocks very difficult to track down
* Rewrote some expensive math in LandObject.cs
* Optimized EntityManager to only lock on operations that need locking, and use TryGetValue() where possible
* Only update the attachment database when an object is attached or detached
* Other small misc. performance improvements
2009-10-19 15:19:09 -07:00
Melanie ffd59868f5 Merge branch 'master' into vehicles 2009-10-19 21:58:51 +01:00
John Hurliman 233e16b99c * Rewrote the methods that build ObjectUpdate and ImprovedTerseObjectUpdate packets to fill in the data more accurately and avoid allocating memory that is immediately thrown away
* Changed the Send*Data structs in IClientAPI to use public readonly members instead of private members and getters
* Made Parallel.ProcessorCount public
* Started switching over packet building methods in LLClientView to use Util.StringToBytes[256/1024]() instead of Utils.StringToBytes()
* More cleanup of the ScenePresences vs. ClientManager nightmare
* ScenePresence.HandleAgentUpdate() will now time out and drop incoming AgentUpdate packets after three seconds. This fixes a deadlock on m_AgentUpdates that was blocking up the LLUDP server
2009-10-18 20:24:20 -07:00
Jeff Ames 0d29614ca1 Formatting cleanup. 2009-10-19 08:58:03 +09:00
John Hurliman fdb2a75ad3 Committing the second part of Jim Greensky @ Intel Lab's patch, re-prioritizing updates 2009-10-17 18:01:22 -07:00
John Hurliman b813058635 Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into prioritization 2009-10-16 13:29:12 -07:00
Teravus Ovares (Dan Olivares) f5964347bd * fix previous commit 2009-10-16 16:25:48 -04:00
Teravus Ovares (Dan Olivares) ac31cb89d5 * Ensure that at least 20 frames run before letting avatar in. 2009-10-16 16:22:10 -04:00
John Hurliman 5a4fda9dc3 Updating OpenSim.ini.example with the section required to enable a useful prioritization scheme 2009-10-16 11:09:18 -07:00
John Hurliman 4b75353cbf Object update prioritization by Jim Greensky of Intel Labs, part one. This implements a simple distance prioritizer based on initial agent positions. Re-prioritizing and more advanced priority algorithms will follow soon 2009-10-15 16:35:27 -07:00
John Hurliman d44b50ee46 * Removed some of the redundant broadcast functions in Scene and SceneGraph so it is clear who/what the broadcast is going to each time
* Removed two redundant parameters from SceneObjectPart
* Changed some code in terse update sending that was meant to work with references to work with value types (since Vector3 and Quaternion are structs)
* Committing a preview of a new method for sending object updates efficiently (all commented out for now)
2009-10-15 15:25:02 -07:00
Melanie 642084c2a9 Merge branch 'master' into vehicles 2009-10-15 21:16:05 +01:00
Melanie 6deef7d0f3 Merge branch 'master' into vehicles 2009-10-15 21:14:13 +01:00
John Hurliman 4790f8576c * Replaced (possibly broken?) math for calculating the unix timestamp in MySQLAssetData with Utils.DateTimeToUnixTime()
* Disabled UpdateAccessTime() function since it was only writing zeros anyways. This gave me a significant performance improvement for startup times and avatar logins in standalone mode
* Load attachments asynchronously so avatars with lots of attachments don't have to race the timeout clock to login
2009-10-14 19:23:44 -07:00
Melanie 6bdd6ae0a0 Merge branch 'master' into htb-throttle 2009-10-14 23:31:38 +01:00
Diva Canto bea13e3709 Setting changeY in border crossing. 2009-10-14 11:01:46 -07:00
Melanie d83ace0d3b Merge branch 'master' into htb-throttle 2009-10-14 05:10:43 +01:00
Dan Lake 5976ac16b0 Optimized heartbeat by calling Update() only on updated objects.
During the heartbeat loop, Update() is called on every SceneObjectGroup which in turn checks if any SceneObjectPart has changed. For large regions (> 100k prims) this work consumes 20-30% of a CPU even though there are only a few objects updating each frame.

There is only one other reason to check every object on every frame, and that is the case where a script has registered the object with an "at target" listener. We can easily track when an object is registered or unregistered with an AtTarget, so this is not a reason to check every object every heartbeat.

In the attached patch, I have added a dictionary to the scene which tracks the objects which have At Targets. Each heartbeat, the AtTarget() function will be called on every object registered with a listener for that event. Also, I added a dictionary to SceneGraph which stores references to objects which have been queued for updates during the heartbeat. At each heartbeat, Update() is called only on the objects which have generated updates during that beat.
2009-10-13 19:32:59 -07:00
Teravus Ovares (Dan Olivares) 31a61bbeec * Fixes some prim crossings on megaregions with regions beyond the 512m mark
* There's a slight chance that this could cause a problem with regular prim crossings..   but hopefully not.     Revert if it does.
2009-10-13 22:03:53 -04:00
John Hurliman dc11643c00 * Consolidated adding / removing ClientManager IClientAPIs to two places in Scene
* Added some missing implementations of IClientAPI.RemoteEndPoint
* Added a ClientManager.Remove(UUID) overload
* Removed a reference to a missing project from prebuild.xml
2009-10-13 17:33:45 -07:00
John Hurliman 23a334b9f5 * Rewrote ClientManager to remove Lindenisms from OpenSim core, improve performance by removing locks, and replace LLUDPClientCollection
* Removed the confusing (and LL-specific) shutdowncircuit parameter from IClientAPI.Close()
* Updated the LLUDP code to only use ClientManager instead of trying to synchronize ClientManager and m_clients
* Remove clients asynchronously since it is a very slow operation (including a 2000ms sleep)
2009-10-13 14:50:03 -07:00
John Hurliman c893761319 * Unregister event handlers in LLUDPServer when a client logs out and disconnects
* Move ViewerEffect handling to Scene.PacketHandlers
* Removing the unused CloseAllAgents function
* Trimming ClientManager down. This class needs to be reworked to keep LLUDP circuit codes from intruding into the abstract OpenSim core code
2009-10-13 12:50:59 -07:00
Melanie 170d2c4660 Merge branch 'master' into htb-throttle 2009-10-12 15:25:42 +01:00
Melanie 70553a979e Merge branch 'master' into vehicles 2009-10-12 15:12:15 +01:00
Diva Canto ef6aa444bf Fixed tree crossing. This will alleviate
http://opensimulator.org/mantis/view.php?id=4163
2009-10-11 13:46:19 -07:00
John Hurliman 77e48a6725 Change the backup thread to run on a BackgroundWorker instead of a Thread. I don't have an explanation, but this seems to stop a slow but steady memory leak I was experiencing 2009-10-09 02:49:55 -07:00
Melanie f6b8bac0fa Merge branch 'master' into vehicles 2009-10-08 10:32:15 +01:00
John Hurliman eb205ef4f0 Added a debug line for nebadon 2009-10-06 14:07:04 -07:00
John Hurliman fa6027aa09 Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into htb-throttle 2009-10-06 12:15:24 -07:00
Melanie 0374f1b144 Merge branch 'master' into vehicles 2009-10-06 17:44:59 +01:00
Melanie 40d0018d66 Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim 2009-10-06 15:29:46 +01:00