Ticket #38 (closed enhancement: fixed)

Opened 6 years ago

Last modified 4 years ago

Support for multi CPU servers

Reported by: mike Owned by: mike
Priority: normal Milestone: alpha-test
Component: server Version: 0.2
Keywords: Cc:
Estimated Effort: 2 weeks Platform: All
State: Complete Relative Size:

Description

Problem

The current server doesn't take advantage of multiple CPUs on a server.

Change History

Changed 6 years ago by mike

  • severity changed from normal to enhancement

Changed 6 years ago by mike

  • status changed from new to assigned

One possible idea is to use the ability of MV3D to run multiple servers in the same application. Run multiple servers in the same app on different threads and find some way for them to communicate. The tricky part will be making it so that having one server with one area and the other server with an area that borders it behave in a simple fashion and they will not duplicate efforts.

It may help to allow a server to cache an area without computing physics on it. It should set up the physics bodies and update them with updates from the primary server, but doing collision checks each frame shouldn't be required. However, updating the physics bodies will be needed so that the objects in the area can be collided with objects in the area that borders it.

Changed 6 years ago by mike

Additionally, some things like pathfinding that can take a set of data and go to town with it should be deferred to threads.

Changed 6 years ago by mike

  • status changed from assigned to closed
  • platform set to All
  • state set to Complete
  • resolution set to fixed

Solution

For some reason, running multiple servers in the same app seems to work fine. I'm hesitant to close this ticket because it probably shouldn't work. I suppose this means that Twisted is thread safe.

The problem I think should be there (but isn't) is that the reactor is running in a seperate thread from the rest of the app. In addition, ODE can't be thread safe either. Adding geoms and stuff should cause issues maybe? Maybe not though.. Who knows. It seems to work, so I'm sticking to that.

It isn't very helpful at the moment though because a server that gets updates from another server causes both to go pretty slowly at present. Another ticket should solve that.

See the --nservers arg in ServerCommandLineArgs for a test.

Changed 4 years ago by mike

  • milestone changed from beta-test to MV3D-0.32

Milestone beta-test deleted

Changed 4 years ago by mike

  • milestone changed from MV3D-0.32 to alpha-test

Setting the milestone back

Note: See TracTickets for help on using tickets.