Zone Clustering
This will discuss setting up multiple Zone Server Clusters in your World Daemon. The kit is setup to scale out multiple zones and onto multiple servers even so it can support a large audience.
The reason this is done is because RPG logic uses a lot of CPU cycles. If you try to cram 20 zones into one RPG logic routine it is going to start to bog down. It is better to put some of your least used zones together and break off your large zones (city zones most likely). So, in short things look like this now in the current setup.
Master Server --- Character Server
-----------------
World Daemon
|
| | |
World Cluster 1 World Cluster 2 World Cluster 3
| | |
(Zone A - Zone C) (Zone D - Zone F) (Zone G - Zone L)
Only routines that need to go up to the Master Server or Character Server will travel through the World Daemon (or over to another World Cluster). Everything else stays local.
Setting this up on a single server is very simple to do without many changes.
Setting up World Clusters for a single server
Make the following changes listed below to get it going. Once you are done you should have extra windows for each of the clusters you created.
mud/gamesettings.py
Make the following change
CLUSTERNAMES = [
("base","landone","landtwo"),
]
Change it to
CLUSTERNAMES = [
("base","landone"),("landtwo",)
]
This example is used for the note of the 2nd cluster. There is only 1 zone it so make sure you have that comma in there. It is not needed if there is more than 1 zone. Also you will notice the comma is no longer needed outside of the brackets as there is more than 2 items now. This would create 2 zone clusters. Another example is provided that would setup 5 zone clusters.
CLUSTERNAMES = [
("base","landone"),("landtwo","testzonea"),("testzoneb","testzonec","testzoned"),("testzonee",),("testzonef","testzoneg")
]
serverconfig\Premium_MMORPG.py
Change
WORLDPORT = 2006
To
WORLDPORT = 2008
This should be fixed in 1.3 SP4. It will use port 2008,2009,2010 for each zone cluster.
affinity issues
It is possible to run into affinity issues if you are testing on a single processor box. The easy fix for that is in zoneserver.py and in mud/worldserver/main.py to comment out the SetupProcessors? line in both. This will skip the affinity setting and let the OS control the affinity. If you have only 1 processor it will try to set the 2nd cluster on the 2nd processor and it doesn't exist. Affinity is just a value telling the OS to use a certain processor and only that processor. Windows will move around a process to another processor to try to balance things out so setting it isn't always needed or even a good idea at times.
This can also be used to use 1 zone cluster and have all of the zones use different processors on a single server instead of stacking them all on 1 processor.
Breaking up into 2 servers
This breaks the kit up into 2 physical servers. The roles are broken down as such.
Server 1 - 192.168.1.60 --------- Master Server GM Server Character Server AH Server Mail Server Server 2 - 192.168.1.50 ---------- World Daemon World Server Clusters
You will need to perform a few tasks.
gamesettings.py on Server 2
Our main services are on a different server, so lets change some values.
GMSERVER_IP AHSERVER_IP MAILSERVER_IP
These need to be set to the local IP of Server 1 (192.168.1.60)
LAN SETUP (changes for server 2)
2 changes here. In gamesettings.py find DAEMONLOCALIP and set it to the local IP of the DAEMON Server on Server 2. This should be 192.168.1.50 per the examples listed above.
Also, set MASTERIP to the local IP of Server 1 (192.168.1.60)
WAN Setup (changes for server 2)
Change DAEMONLOCALIP to the local IP of Server 2 (192.168.1.50 in this example). Also do the following:
A bit harder to do with ips and such. First off, you will need to change your port forwarding on your router.
- TCP 80 - Server 1
- TCP 2007 - Server 1
- TCP 2008-20xx - Server 2
- TCP 6667 - Server 1
- TCP 7001 - Server 2
- UDP 29000 - 29xxx - Server 2
Server 2 will hold all of the world/zone ports and those are the ones you need. Next, you will need to make a change to the HOSTS file. On Server 2 your WAN address needs to point to the local IP of Server 1 (192.168.1.60 in this example). Server 1 should use its own IP address in the HOSTS file so both of them should point to 192.168.1.60.
Once that is done you should be ready to go.
Modify the scripts and run them
On Server 1 you do not want the worlddaemon to run, so open up startup.bat and remove it. On Server 2 you want only the worlddaemon to run, so open up startup.bat and remove everything but it. You will then run startup.bat on Server 1 and then startup.bat on Server 2. If everything is well you will be able to connect and it will bounce you around properly.
