Server architecture
This wiki is mainly focused on the viewer, since that is the portion of the system that is open source. However, because the viewer interacts with the Second Life servers in somewhat complicated ways, it is helpful to have an understanding of what components do what on the server side.
Much of what you'll need to understand is actually covered in the protocol documentation. In particular, take a look at Authentication Flow, which outlines the process by which the viewer establishes connections with a number of components.
Components
Login server
CGI script running on login.agni.lindenlab.com. Handles verification of user name and password. Determines the login region based on home vs. last location vs. URL specified location. Finds the simulator process running that region and verifies user is allowed to connect there. Alerts the simulator to expect a connection. Informs the viewer of where to connect.
Userserver
Historically, the user server handled login. Now it handles instant message sessions, particularly for groups.
Spaceserver
Handles routing of messages based on grid x,y locations. Simulator talks to Space Server to *register* and also find who the neighbors are.
Dataserver
Handles connections to the central database, log database, inventory database(s) and search database(s). Performs queries on behalf of the simulator process.
Simulator
The primary SL server process. Each simulator process simulates one 256x256 meter region. As the viewer moves through the world it is handled off from one simulator to another. It handles storing object state, land parcel state, and terrain height-map state. It performs visibility calculations on objects and land and transmits the data to the client. It transmits image data in a prioritized queue. Physics simulation is handled with the Havok physics library. Chat and instant messages are processed here.
Running at full tilt, a simulator will run at 45 frames/sec. If it can't keep up, it will attempt time dialation without reducing frame rate.
Simulators communicate with one another using a circuit via UDP. A "circuit" is a UDP network connection. Circuits are maintained between adjacent simulators.
Simulator vs. Viewer
It helps to understand the division of labor between the simulator and the viewer, since the split in Second Life is very different than most other virtual environments:
- Simulator's job:
- Runs physics engine
- Collision detection
- keeps track of where everything is
- Sends locations of stuff to viewer
- Sends updates to viewers only when needed (only when collision occurs or other changes in direction, velocity etc.)
- Viewer's job:
- Handle locations of objects
- Gets velocities and other physics information, and does simple physics to keep track of what is moving where
- No collision detection
Other servers
- Central Backbone
- Agent Database
- Agent DB keeps track of metadata<->item id (UUID) mapping
- Central DB (CDB)
- a list of who owns what, used for billing, etc
- Find DB (replica of Central DB used for search)
- Map server - renders overall map with OpenGL
- RPC server
- API for developers to manupulate Second Life without using the viewer
- Translates XMLRPC server into in-world requests
- Communicates with space server and CDB