Dispersion processing will be the ability to have future MUD (reproduced: I don't know what I found there :))

xiaoxiao2021-03-06  40

Dispersion multi-user space

Oyster

Challenge the upper limit

The King of Kings was officially opened to the outside world last December. In less than a year, he repeatedly broke through the upper limit of the number of people in LP MUD, so far, it can accommodate 320 users, it can be said that Taiwan's largest LP MUD.

In traditional MUD, the user can engage in activities, nothing to slashing monsters, puzzles, completing tasks and interact with other players. In the king of Wan Wang, in addition to these things, Wang King provides a set of ways to make users can play imagination, create their own country, constructing their imagination, even if you don't write.

The first time I tried this type of MUD and didn't expect to be so popular. In less than a year, even many features have not been completed, there is no newcomer to join this game space. It turned out that I didn't want to set up the number of people. We hope: "I can play it when I want to play." However, the number of people has repeatedly increased, and the whole system is slow, so we keep trying to improve the number of people, including rewriting MUD LIBRARY, replacing hardware, updating the Mudos version, modifying Linux Kernel to break through the File Descriptor upper limit 256 limit, etc. .

After several computers upgraded, the hardware equipment of the King of Wan Wang is Pentium 200 (although using O), 96 MB RAM, 450MB Ide Hard Disk. So we started thinking: Is it not so can't? Be sure to constantly pursue the updated machine to accommodate more people?

What factors are limited to the upper limit

Definition of the number of people

Response Time: This time from the user issued a command to the result of the result is a response time.

Response Time = Network Transfer Time (Rurg) Time to Execute Instructions

Factors affecting network transmission time include factors such as Routing, Propergation delay Time, Bandwidth, etc., most of which we cannot master, (by the actual measurement, the BANDWIDTH required for 220 people is about 0.2 Mbps, the general 10 Mbps Ethernet Foot As a competent), we will focus on the time of executing instructions, that is, MUD Server ends.

The time spending the user instruction is related to the number of people on the line, the more people, the longer the response Time. The number of people who can accommodate in the response Time accepted by the user can do the upper limit.

LP MUD operation scenario

LP MUD The entire system includes two layers of MUD OS, MUD Library. MUD Library writes in an object-oriented language LPC to construct the entire virtual world. The world you see, the instructions used are all between MUD LIBRARY. MUD OS can be seen as a mud's Driver, which is really let MUD move. In the following description, MUD OS is the same meaning as Driver represents, and Mud Server is included with OS and Library.

When executed, Driver will turn the library of LPC to the intermediate code. When executed, the intermediate code is executed, so it is an interpreter in the way. It should be noted here that it is not the beginning of the entire library into an intermediate code. Only one small part must complete the conversion when starting, most of the programs are used to compile and execute the action. . After transferring the middle code, it is not necessary to recompile unless it is cleared.

MUD OS can be seen as a Virtual Machine to perform exclusive intermediate codes. In Virtual Machine is Single Thread, that is, once, you will be executed with a Method in an instruction or object, and it will be turned to the next. MUD needs to handle the following three things:

1. Every fixed interval must be performed: For example, the heartbeat of each organism.

2. Call_out queue: In order to cause the delay in order to cause the delay in execution, some instructions will have a few seconds after a few seconds. It is a bit like Sleep (). MUD OS will hang the request for call_out in a queue, check if it is executed every occasion.

3. Users under the user.

The whole process is probably written:

While (1) {

Process_heart_beat (); // Heartbeat, once every two seconds

Process_call_out (); // Call Out Queue

Process_user_command (); // User Command

}

Fig. 1

Number of limitations

Back to the front

Response Time = Network Transfer Time (Rurg) Time to Execute Instructions

and

Perform the time of the instruction = f (the speed of the hardware, the performance of the Virtual Machine, the complexity of the instruction itself, the number of items, the number of users)

Among them, the number of objects is affected directly by the number of users, and the careful design can reduce the complexity of the instruction.

From the process of Fig 1:

1. The more users, the longer the time of the process_heart_beat, the longer the Response Time.

2. The more users, the longer the previous user instructions are performed, the longer the response Time.

3. The more users, the more items that are loaded into the memory of the memory, and therefore the longer look for the time of the object. Almost every action in MUD must look for objects and directly affect the length of time execution of the instruction.

The upper limit is limited by the response Time that can endure, and the response Time is related to the hardware speed, OS and Virtual Machine performance, and the other main impact is the number of objects.

How to improve the maximum number of people

1. Lift the hardware equipment:

a. Use the faster CPU

b. Use high speed memory and hard disk

This is the easiest way, however, the speed of hardware upgrades does not grow up to the population of the network world, and if the number of people is saturated, the machine will need a considerable fee.

2. Strengthen the performance of Virtual Machine, be careful with Library

¨ Now many of the MUD on Tand is used to use foreign Virtual Machine (MUD OS, DRIVER), using the new version of Virtual Machine, can significantly increase the execution speed.

¨ CAUTION Library, try not to design too complicated, and optimize some of the time-spending action and instructions.

¨ The optimization of Library is limited, and only 10 ~ 20 users can only increase by up to 10 ~ 20 users.

3. Reduce the burden of stand-alone

This idea is very simple, very direct: Since a machine can accommodate people limited, then use two machines to run. Different machines to run MUD not only disperse users, disperse the area, disperse the object, disperse network I / O, reduce the burden on the stand. In the future, if the number of people is saturated, the old machine can continue to use, only need to add new machines, some lower-order machines can also be used to share part burden. It is necessary to consider the dispersion, the Communication Overhead between the machine and the machine will not be greater than the benefits obtained. Dispersion multi-user space

The same MUD, character data file, regional file, etc. in several different machines, which are the easiest way, but the characters in the machines are inconsistent. This can only be called the same MUD in this way.

Another method is to use NFS. The human data file has the same hard disk, and each machine reads the character data file through NFS. This regardless of which machine is connected, his information is consistent. The problem to be solved is that the same user can connect these different machines on "same identity", "simultaneously", causing the inconsistency in the memory in the memory. Secondly, this method only has a dispersed user, and does not disperse the area of ​​the virtual world. Each machine must have a complete virtual world, and the user in different machines can not see it in the same room. Go to each other.

Design premise

Although this is a decentralized virtual world, we hope that users can't feel, that is, emphasizing his transparency. In addition, in order to retain all users, we hope that all users can join this world with the original habit (Telnet, Tintin, Zmud, etc.) without changing. These two points have become the biggest challenges in design.

Architecture

MUD Server

MUD Server

Agent

Telnet

Tintin / ZMUD

Exclusive Client

Description

1. A complete MUD OS with MUD LIBRARY is performed on each machine, and part of the DAEMON, basic objects, and instructions will be performed, and the virtual world is cut, and only one area is responsible for each machine.

2. Take a configured area to specify the area responsible for MUD Server. When MUD Server is started, you must report the area responsible with the Agent program. Agent has information on regional machine corresponding relationships.

3. With KK as an example, the cutting point of the area can be a port, national or refall, Summon, Teleport, etc.

4. When the user walks from the area A to the area B, it can be transmitted from the following two methods.

a. Use exclusive client

If the user uses a CLIENT that is a MUD, when he walks to the cutting point, when you want to go to another area, MUD Server A first issues a request to Agent, and ask which server is responsible for the area. If Agent replies to Server B, a notifies the Client program to B. When the client is connected to B, the connection to the A is cut off.

b. Using the original Client

Telnet, Tinti, ZMUD, etc. did not actively transfer the functionality of the connection. Of course, we can send a message to tell the user: Which machine you are now, but this does not meet our expected goals. And for new users, he may not know what to do. So this time we need an interface, which is the Agent in the architecture map, which helps users handle these transfer Connection things.

From the Agent when the user wants to walk from A to B (or moving from machine A) MUD Server issues a notification tells the agent, transferring the connection by the agent, and the user with the Agent does not need to cut or re-need connection. 5. The function of Agent

¨ Agent has the information corresponding to the regional machine, and even change the distribution of the region, re-distribute the user (Dynamic Load Balancing) when necessary.

¨ Agent must be able to send MUD SERVER to MUD Server after the instruction entered by Forward users, then transferred back to the user.

¨ All connectors must read part of the data (Password, last time offline), can avoid multiple login issues.

Possible problems

CHANNEL broadcast message

For example, CHAT, RUMOR, etc. Channel.

All CHANNEL messages are handled in the same way. 1. Server broadcasts all Client, 2. Send to other Server, and broadcast the message from each server.

2. Talk to Server

For example, TELL, Reply, Finger, is sent to a specific user.

Server sent a conversation content to each Server, looking for this particular user by each server.

3. CONSISTANCY in Daemon

The general MUD will not have this problem, but the KK is in Kingdom daemon due to many Kingdom daemon, the state of the state development status. If KingDom Daemon is only in a server, there will be a Query action across the Server, which we don't want to happen. The "Query" action across the Server is not only involved in the distributed object management (how to find a particular item), which will be quite amazing. Once there is a Kingdom daemon on each Server, it is necessary to pay a price to maintain his consistancy.

4. Agent burden overweight

When there is no access to the exclusive Client, you can find that all the Connection is concentrated to the Agent, and the number of bottlenecks will be transferred to the Agent.

Conclusion

In the current computer user, I know MUD and play MUD people should still be a few, although MUD is more advantageous than PCGame, but it is currently waiting to be promoted, and people who use MUD will believe in more, after the user increases. The machine load and network loads brought are the challenges that MUD designers must face. Dispersion MUDs can solve these two challenges and reduce the load to an acceptable range. In the future, in the process of progress in MUD to graphically, various loads will only be more and more serious, and it is believed that appropriate dispersion will be the ability to have future MUDs.

转载请注明原文地址:https://www.9cbs.com/read-56618.html

New Post(0)