Game Backstage Talk: The background language, system and architecture

Source: Internet
Author: User

Text/wind between the pale moon

  Objective

The main trample pit game backstage n years, devastated countless, in the process of suffering, because of the work relationship, have been fortunate to see a lot of project structure and realization way; also because the familiar brothers each run West East Independence Hill, learned some small company's backstage survival way. A little sentiment, a hint, looking at the expert pointing.

First, about language

Do the game, first have to do, how to do, just learn to program the hair of the boy know, write code AH. OK, the first question comes, how to write? What do you write with? This TM is not nonsense, with the computer, with the keyboard to write AH. Uh, uh, look at the title of this section to know, is to ask what language, what programming language good.

This is the first idea in the mind of the master.

Write backstage, not all of C + +, just into the entertainment of some graduates will say so. Well, it's because you've only been in the Goose factory.

Java written backstage have you ever seen it, like, seven bucks?

Uh, uh, it's like Erlang also has, the page Tour era has swept the Guangzhou.

Please do not forget Php yo, gfw outside of the Facebook can play.

Right, in fact, JS can also do backstage, as well as ASP, C # God horse ...

The Lord can still chat, and then go on, not all the language is written backstage!

In fact, the Lord wants to say, the fact is almost like this, but the Lord has not finished speaking, Sir you have seen a game in the background n modules using n languages, no? And then, then, the game is dead .....

<ignore_js_op>


Hello, master, fart put so much, can you say the key?

Sir you do not worry, wait for the niche slowly, about the language, online has a series of comparison, pretty image, but correct, sir you see from a:

<ignore_js_op>

<ignore_js_op>

<ignore_js_op>

<ignore_js_op>

<ignore_js_op>


But with regard to language choices, the Lord has something to say, which language to choose is definitely not because it is good, just because it was the right place at that time. For example, Sir you in the Goose factory backstage to move bricks, everyone moved is C/s + + brick, you have to move a Java, not no, your home contractor agree? Do you want to do a re-set for the brick assembly line? Move up and turn around, is there any hurry before? If you run your butt off, is there someone to wipe your butt?

For the first few years of the Mao Yangcheng N multi-erlang game backstage? There is an uncensored Erlang game frame outflow, you know, I am the boss I also use Ah, their own people to masturbate the basic framework, time-consuming effort is not easy to use, why bother.

Alas, for hair is also quite a small company with Java, with C + + is not very good? Alas, sir, C + + code farm expensive Ah, Java, early years Beida Jade Bird can be mass production ah, that cheap, the market will Java monkeys also find, a lot of program ape Rob come.

No, the Lord, you are not talking about the efficiency of what, not the right, C + + how fast ah, the difference between the order of magnitude good? Sir, outside the food company, do a game single service perennial hundred people online can eat full belly, thousands of people online can ecstatic, to be so efficient to do, can survive is the kingly ah. I opened the five-ling Hongfeng roadside selling fruit, you do not want me to the Volvo heavy card, really can't afford ah. Massive service? Of course, but that is the bat thing, the outside of the small people, even a plume is not necessarily enough to get, the vast number of look good.

BTW, the Lord still can't help again p words, the industry a quite famous company, the development of the most good is X (IA) J (i) B (a) L (Uan) x (IE) mode, a variety of original 艹, but, still can use, cough, we have Internet service is such a level, Deep in the Goose factory good happy stable good happiness ~ ~ ~

Second, about the system/os

<ignore_js_op>


Do the game, the backstage switch to that system? Again a topic of egg pain, said not good again by people spray, say good, that is impossible ...

Some of the major Internet companies we know, and the large and small companies outside, in the backend system, Linux can be said to occupy a dominant position, so analogy, and the PC on the monopoly of Windows is so similar. What makes many high school low-cornered yards of farmers, are inclined to choose Linux?

Some say performance, such as JVM performance comparisons between Windows and Linux (not verified by the master); some say open source, everything is under control (provided it is capable); some say that communities, resources and support are good; some say stable, Linux can run n years without restarting; some say free, 0 cost and others say Blablabla ...

<ignore_js_op>


Well, it's quite reasonable for everyone to say so. There were some discussions before the Lord, and some of the ideas were echoed by the Lord, and the technical advantages of Linux reaching its current scale are secondary. The "network effect" that determines the current status of Linux today

<ignore_js_op>


Sound and front windows in the field of PC analogy a bit like, in fact, is one thing, and then say a word, this and QQ rule PC is the field is also a reason, Sir you have grown up, estimated that your life has three numbers will not change: ID number, height and your valuable QQ number.

A little more fart, and a classic word: "You come because of the product, you stay because of the ecosystem."

<ignore_js_op>


Back to the initial question, what should we choose? Depending on the environment and conditions you need to survive, are you starting from scratch, or are the network logic components sound? Is it to delete or change the existing project, or to pick up the tools to rebuild the building blocks? It is advisable to make decisions based on actual conditions, such as in the Goose factory, we have a variety of mature components such as tsf4g, operation and maintenance tools and development experience accumulation, Linux is the ideal choice, and a game company has a mature operation of the Windows back-end MMO game, the relevant component tools enough new projects, It's not a bad thing to go ahead and continue Windows development. So,what ' s your decision?

<ignore_js_op>


Iii. about the architecture

<ignore_js_op>


In general, well, in general, the game backend architecture can be divided into 4 layers: Access layer, logic layer, forwarding layer and data layer. The general game, up to the QQ game bearer tens player simultaneously online big game platform, down to the simplest partition service function extremely simple game, also basically is to follow this routine to walk, only at the individual point has the expansion or the simplification.

God horse sir you do not believe, the Lord gives you two examples:

<ignore_js_op>

<ignore_js_op>


The above two are all qqgame back-end architecture, an old 1.1 new point, basically almost good, please do not care about the details.

The player interacts with the logic Layer game server through the Access Layer lotus/seedsvr, and the storage service between the game server and the data layer is completed by forwarding layer proxy. Perimeter system? The figure may not show very clearly, actually also through proxy for transit. Well, it doesn't look very complicated at first glance, does it?

In this to worship to lay the cornerstone of the qqgame structure of the great God has always, in the total and a number of T4 and quasi-T4 great efforts, Qqgame had achieved this difficult achievement. Qqgame has always been high-skilled many can not be enumerated.

Off-topic run, we look at the second example, the main responsible for the game, Goose factory The first self-study page tour "war Warring states" background structure:

<ignore_js_op>


Beacon Division of clothing, single-zone carrying capacity is much smaller than the whole area of the game, at the architectural level, than the QQ game to simplify a lot, but still do not escape the 4-tier architecture of the fingers Mountain: the player through the access Layer ENPSVR connected to the logical layer game server MAINSVR, Mainsvr, however, is linked directly to the data-tier server Dbsvr. The only missing, is the forwarding layer, because in the single process without the line MAINSVR framework, the business has hold more than the pressure of the online, forwarding layer and no need to exist, all business logic can be concentrated in mainsvr inside complete, not only simplifies the architecture, but also improve the development efficiency, Why not.

OK, the front said the Goose factory, the outside brothers how to toss? In fact, original aim, basic or follow this routine to go, June see there is also directly take tsf4g components out of the open, eh, as if to say what leaked. Do you have a card that doesn't follow the norm? Yes, but very few, the small team is too limited by the staff, to personally go personally, of course, is relatively important to the cattle, can lead to changes in the structure, responsible for the different modules of the people of their own blind JB Daoteng, make the structure looks complex, and finally put their own pit dead is not No. Simple is the best, Jane is the United States, it is easy to say that it is difficult to do, oh ah.

In addition, say a face, this layer is a TM virtual, are so, there is nothing to say. What really dead end is how to design and organize according to the requirement of the project in each level, and how to effectively connect each layer under the premise of satisfying the product requirement. But this, surging river is very deep, must be combined with the project said to have meaning, in view of the length and the level of the master himself is limited, said not clear also not good to say, and so the next time the rise of the Lord, and then we pull the light.

  Four, about the topology of the schema 2--schema

Before the general introduction of the next common game architecture, let's make a big point, see can pull out something. To give you 5 minutes, you might as well put your own business out of the network operations deployment topology drawing out.

Eh, this classmate is very swift and violent, 5 seconds is done! No on-line has failed what chicken neck lively! out!

A minute, yo, a classmate handed in, well, good, partition small game, simple, server is not many, the relationship is simple and clear, PCU are 10w, good.

<ignore_js_op>


Two minutes, and another classmate handed in, well, complex partition game, and cross-service, the relationship has been well combed, PCU are dozens of W, nice!

<ignore_js_op>


Three minutes past Ah, the classmate handed in the exam is, the whole region to take the game, a lot of nodes, the relationship is quite complex, difficult for you.

<ignore_js_op>


Hey, hey, what the hell are you doing, brother who's doodling on the picture? Ah, a simple region-wide game to make this bird-like, everywhere is connected, just a few servers on this virtue, you want to and the above two Sir like hundreds of thousands of servers, think of the brain crack it!

<ignore_js_op>


You crossing, if you have thousands of machines on the line of business, to not have a good architecture, how to comb the topological relationship, how to maintain the system? I'm afraid it's harder. Oh, no, sorry to say wrong, to really do not have a good architecture support, I am afraid is not to do thousands of machines of the magnitude of the fart it, hehe.

Alas, for Mao good to say the structure, and talk to the topology up, not a GA ah. The main self-thought, the good architecture is also a work of art, looks concise, beautiful, has the connotation also the thief to use, is not beautiful the structure, more or less will have some problems. Don't ask why, the artist never says why.

In that case, let's talk about what the topology of the architecture is. Game architecture can not jump out of the framework of the network, we have to learn the network before the course, on that computer networks classic textbook, the above is how to say, the structure of our game, but also in this in the fingers of the mountain inside good, and the master of the online copy of a few common please ye read:

<ignore_js_op>


 1. General line topology

<ignore_js_op>


The bus topology uses a channel as the transmission medium, and all the sites are connected directly to this public transmission medium through the corresponding hardware interface, which is called the bus. Signals sent by any one station are propagated along the transmission medium and can be received by all other stations.

Advantages of the bus topology:

1) The bus structure requires a small number of cables, short cable lengths, easy wiring and maintenance.

2) bus structure is simple, but also the source work, there is high reliability. High transmission rate up to 1~100mbps.

3) Easy to expand, increase or decrease users more convenient, simple structure, easy networking, network expansion convenience

4) Multiple nodes share a transmission channel, the channel utilization is high.

Disadvantages of the bus topology:

1) The bus transmission distance is limited, the communication range is restricted.

2) fault diagnosis and isolation is more difficult.

3) Distributed protocol does not guarantee the timely transmission of information, and does not have real-time function. The site must be intelligent, with media access control, which increases the hardware and software overhead of the site.

 2. Star topology

<ignore_js_op>


A star topology is composed of a central node and each site that is connected to a central node through a point-to-points communication link. Central nodes perform centralized communication control policies, so the central node is quite complex, and the communication processing burden of each site is very small.

Advantages of star topologies:

1) Simple structure, convenient connection, management and maintenance are relatively easy, and strong extensibility.

2) network delay time is small, transmission error is low.

3) support a variety of transmission media within the same network segment, unless the central node fails, the network will not be easily paralyzed. Therefore, the Star network topology is one of the most widely used network topologies.

Disadvantages of star topologies:

1) high cost of installation and maintenance

2) Poor ability to share resources

3) Communication line utilization is not high

4) The central node requirements are quite high, once the central node fails, the entire network will be paralyzed.

  3. Ring-Type topologies

<ignore_js_op>


A ring topology network consists of a chain of sites and connected sites that form a closed loop. Each site is able to receive data from one link and serially send that data along the ring to the other end of the link at the same rate. This link can be one-way or bidirectional.

Advantages of the ring topology:

1) Short cable length. The cable length required for a ring topology network is similar to that of a bus topology network, but is much shorter than a star-shaped topology network.

2) When adding or reducing workstations, only a simple connection operation is required.

3) optical fiber can be used. The transmission rate of optical fiber is very high, and it is suitable for single direction transmission of ring topology.

Disadvantages of the ring topology:

1) The fault of the node can cause the whole network fault. This is because the data transfer on the ring passes through each node on the ring, and once a node in the ring fails, it causes the whole network to fail.

2) fault detection is difficult. This is similar to the bus topology, because it is not centralized control, fault detection needs to be carried out on the network nodes, so it is not easy.

3) The Media Access control Protocol of the ring topology is made by token passing, and the channel utilization is comparatively low when the load is very light.

 4. Mesh Topology

<ignore_js_op>


In a mesh topology, the connections between nodes are arbitrary, and each node has multiple lines connected to other nodes, allowing multiple paths to be selected between nodes

Advantages of a mesh topology:

1) High network reliability, the general communication subnet between any two node switches, there are two or more than two communication paths, so that when a path fails, you can also send information to the node switch through another path.

2) The network can be formed into a variety of shapes, using a variety of communication channels, a variety of transmission rates.

3) It is easy to share resources in network nodes.

4) can improve the information flow distribution of the line.

5) can choose the best path, the transmission delay is small.

Disadvantages of the mesh topology:

1) control complex, software complex.

2) High Line cost, not easy to expand.

3) in the Ethernet, if set improperly, will cause broadcast storm, serious can make the network completely paralyzed.

Above those advantages and disadvantages, are scripted, in the game architecture, that is irrelevant, can not mechanically, but also can see some clues, you want to transfer the physical network inside the packet, imagine a high-level data packet, perhaps understand, we take more common mesh and star topology to pull an egg.

Network architecture is the most intuitive, need to be connected, direct communication, carefree!

But the refreshing result is that it will not stop completely!

Here need to even, there need to even, even to go to the end, a little more servers, the entire topology that is not bear to look straight ah.

PS: Here only for the architect in the novice village, in the absence of the recruit win a dog wet hand, can be a mesh topology to play the flowers you believe it.

Words to break back, the advantages and disadvantages of the network architecture is very clear, the size of the time, clear, the message path segment delay is also relatively small, any single node hangs, the basic will not make the entire architecture paralysis; but in large-scale architecture is not suitable for direct use, will lead to the overall control is extremely complex, not easy to expand the capacity The early telephone network in the web textbook is the best chestnut.

As for the star architecture, the core is a central point, the central node outside the server is not directly connected, all messages through the central node relay, sound familiar is not, yes, this center point is like in the previous article mentioned in the QQ game structure inside the forwarding layer proxy, in fact, this is the case, We can put the structure of the QQ game, rough as a large and big star topology-based mixed-type topology.

The advantage of this is that after decoupling, the structure of simple maintenance, expansion and contraction capacity, the basic does not affect each other. Well, then the problem comes, the disadvantage is what, it is clear that the center of the point is the entire star-shaped structure of the life gate Ah!

The fate of the door to kneel, the whole structure is finished, direct fart has a wood!

Therefore, for this obvious flaw, also derived a variety of solutions, in this first sell a Xiaoguanzi, this is to be mentioned in the next single point problem.

   v. About the architecture 3--a little bit of detail

There are no architectures 1 and 2 above, why there are 3! The Lord stole the thought that the previous mention of a simple overall structure, does not explain what, after all, in the case of all kinds of components, the architecture is more and more stereotyped, really can affect the results, is some details.

Uh, uh, didn't you say you didn't care about the details before?

Subject to the limitations of space and ability (this is the main factor), the Lord will use the speed of the Lightning thief to briefly talk about some of the details that need to be considered when the architecture is implemented.

   1. Single point and disaster tolerance

The single-point and disaster-tolerant two same boat are inextricably linked. Why do you say that, to tolerate disaster, basically to avoid a single point, if a module is a single point, there is a risk of disaster tolerance. So, does that mean that when we design the architecture, all the nodes have to avoid a single point?

In a sense, yes, but not absolutely. Why, first of all, I want to avoid a single point, the simplest example, if the data layer only DB No DR, in case DB hangs, directly hehe is not it. OK, this is the data layer, a variety of hot and cold standby synchronization company and the industry have a more mature program, the Lord will not swim, talk about something else.

The logic layer, if a service is stateless, deployed with multiple machine services, while a mechanism to detect a single point of failure and the corresponding service traffic cut away, but also to achieve disaster tolerance. However, if there is a state, the situation is complex point, when the state is relatively important, to do so eagerly, then it is necessary to do the state synchronization between the main preparation, or cut the past will have to fart. For an extreme chestnut, db, uh, uh, not a logical layer, but please do not care about these details, DB data, is a state, and is strong state, so, the back of you understand, if there is no synchronization of the DR, you cut up to be sure not to shake the hand?

For some weak state, according to demand, some can be degraded to stateless server processing, the user's loss, is usually acceptable, such as some login state and memory data, even the cache of player data, the maximum loss of the length is also controllable, cough, by the background reasonable design to control. In accordance with the company TDR3 Standard, the requirements of the Disaster Tolerance section are:

   "Disaster recovery treatment"

1. There is no single point (non-expandable node) on the critical path (game core experience, gameplay).

2. The data changes in the cache are not allowed to be reported in time, resulting in a return of more than 10 minutes.

BTW, personal opinion, for differentiated service game, because it is born to be a disaster tolerance design-ah, this area can not play you to other areas to play the egg-in the single-zone disaster tolerance design simplification, to ensure that the core Line no single point, is enough, if everything to a single point, this design and operation and maintenance complexity and operating costs , I think it's enough for everyone to have a bottle.

Good, the front pull a bit of the egg crack, a little summary, how to avoid the single point of the problem, the core is not exist single point.

Then the total 2nd, not a single point of the case, if there is a server hanging, how to switch?

1) The state is fully synchronized, can be arbitrarily switched, example is the previous said countless times DB, DB, db.

2) Not too care state of the main standby mode, X1 downtime, subsequent requests to switch to X2.

BTW, and then pull away, can normal switch, but also pay attention to cut past the standby machine can resist the new pressure of the request to live. If it is hot and cold standby mode, standby performance is not as good as the host, or dual-machine hot standby, before switching a single server pressure has exceeded 50%, then once one of the server fart, can normal cut past, is really a question mark, no, maybe an exclamation point. In case of bad, overload protection does not enough, a laminated layer, avalanche, it is not just exclamation point.

OK, finish the Goose factory, talk about some small companies. Generally speaking, everyone on the data layer of disaster and single-point processing, or there is a consensus, after all, the player's happiness Nima based on a few hundred K data, to direct data loss, but also TM can live? Therefore, everyone in the data layer, the relative is still relatively consistent.

But, generally there is no good, yes, in other respects, that is really a variety of, so-called Eight Immortals crossing recount bird. Part of the bat system brothers, to this piece still have a better understanding, know which places to avoid the risk of disaster tolerance, but due to the time labor cost, grace, and the inertia of the yards and the lack of experience and cognition, quite many small companies, for other layers of disaster tolerance, the basic is indifferent. Some of the agent games that go through the TDR process also have similar situations. Some small developers also plausible, this module/server has never had a problem, do not worry, the master thought, no problem, no amount of user time, really do not worry, even if hung up also don't worry too much, worry is in case people more you hang up, can carry the live, see your old life.

<ignore_js_op>


But, the Lord is here to put a fart, everything has a priority, some small developers on the top of the slot, others, at least, is also a small into the bar, for those who have just started the brothers, this TM is not a thing, first to do products to be done to say, not good on the dead? Not yet to consider what a single point of disaster, the following points, similar. And so can feed from a, need to face the problem, then to consider it, Tony boss in the mass of the road inside not also said, first carry, and then optimize. If you have brothers and sisters out there, let them have a meal, encourage encouragement, do their best, and listen to the destiny.

2. Load Balancing

It says a single point-of-disaster, The main mention is the program and machine failure problems, in fact, there is a point, what, performance single point, the program is not hanging, deployment is not a single point, but a single server performance to the top, the avalanche, the same impact experience. At this point, the load balance needs to be sacrificed. There are a number of strategies for

Load balancing, and there are two key points: the load balancing algorithm, and the method of checking the load on the server. First of all, the server load of the high and low, and the characteristics of the server itself is related to, for example, some CPU load type, some IO load type, and some eat memory. Therefore, the server load judgment, also needs to be tailored, you take CPU consumption to measure an IO load of the server, must be unreliable. In general, system statistics such as CPU, memory, disk/network IO, and process data such as throughput rate, average/maximum response time, success rate, etc. can be measured, which is the appropriate?

has a measure of the standard, the following simple to talk about some simple common load balancing algorithm, the main experience is still shallow humanely not deep, can only donuts, but also ask high people to add guidance.

    • Random type. Random, throw out, simple violence, good, the front pulled a half-day load capacity to measure white blind, no matter, no so-called Ah, do it is the greatest advantage of simple, and finally are not balanced on the fate.
    • Based on the polling type (Round Robin), regardless of 3,721, one wheel up, or regardless of the backend load, as long as not dead, round Bai. is still simple, but compared to random, multiple advantages, in the backend server hardware and software performance close and the request is relatively average, the load is relatively balanced.
    • Hash type. Depending on the requestor's key,hash to a different server. Goose Factory, take uin do key hash, many, if the user number segment evenly distributed, load balance is also good, the implementation is also simple, but the same did not consider the machine load, once the outage on the impact of a number segment access to fart (not considering the case of standby machine).
    • Poll/random with weights (Weighted Round robin/random). Basically is the random type and the poll type improvement version, the Unity Block said, does not separate. With the weight of the method, the server load is taken into account, dynamically adjust the server's weight, the high value of the service will be allocated to the probability of a higher request. When the load rises, the weights are adjusted periodically to reduce the amount of processing requests. Load balancing with weights is not necessarily the choice of a high-weighted server, because during the interval of adjusting weights, the high value server may be crushed by a burst of requests. Given the load on the backend servers, this load balancing algorithm will be relatively homogeneous, and of course the implementation will be complex.


In the actual business, what kind of load balancing algorithm will be used, there are many factors, such as whether the service is in a state? Are there timing relationships for different requests? Is there a logical dependency on the front and back request? Different conditions, resulting in the final choice may not be the same, not look good things are TM is the best use, you or Xu Xian, white snake do not touch, interface type is not AH.

   3. Data consistency

Strictly speaking, the data consistency, and can not be visualized from the architecture design, but his importance, but is very very very important, after all, the players spend a lot of money, buy only you have a few bytes of data in the DB.

Data consistency can be divided into two areas: one is cache and DB consistency, the other is the consistency of data modification. First of all talk about the cache and DB consistency, the data layer itself cache and persistent storage I will not talk about, a few words can not go on, talk about the logic layer. In order to reduce the db pressure, the general game logic Server will more or less cache some player information, write back, or not necessarily instant write, then in this gap period, in case the server crashes, it will cause "up-to-date" data loss. How to evade, data plane, in fact, it is very difficult, you did not write to the inside of the DB, to avoid a ball of eggs! Besides, there is not a lot of game business to do player data to ensure that the data are not lost, not to do, the key is to achieve the relative cost of income, not too worthwhile. So, how do you get it back in the fart? Important data, we all have bills and journals, through the Bill check, basic or can ensure that the core data can be recovered, the general self-research game is so dry.

Another, if the logical design is the other server pull the player data directly from the DB, then in the above conditions, there must be read to the data is not "up-to-date" data. If only to make a display, in fact, the inconsistency is not unacceptable, after all, even if you pull up the latest data, if the display process has been updated, and did not push, it is still out? However, if the data pulled into the key logic, or subsequent modifications based on these data, then inconsistent, the problem is big. How to solve it? It's easy to say, pull the data from where you keep the latest data. As for how to pull, different business is not the same, in this does not elaborate.

Read consistency is done, the most critical write consistency comes, how to ensure the correctness of concurrent modification. Correctness is based on a premise, what? Every time he modifies, he is based on the underlying data that is up-to-date. How to say, if the initial state of a data is A0,SVR1 and SVR2 respectively get A0 data, one wants to change to A1, the other wants to change to A2, then, regardless of the final write order and the result how, may be problematic, because if SVR1 first changed to A1, Svr2 then get A1 data, Instead of A0, it is probably not A2 but A3 value that will eventually be written back.

Fart say a lot of, get some practical, how to ensure consistency of writing, the common solution has a lot of, in essence, in essence, is the serial of the concurrency. OK, let's take a look at some more solutions:

1) Data lock. Whether it is a row lock or a field lock, as long as it is possible to modify the data, then before reading the data lock, then the subsequent other may need to modify the data operation, lock will fail, before the lockout operation is completed, there will be no new modification operation concurrent generation, OK, write serial. Read it? Pure reading is at your discretion, and does not affect eventual consistency anyway. But the problem comes again, lock, it means the concurrency of the decline, and if it is allowed to lock the data at the same time, then the other servers have cached the same data, after the changes have to receive the corresponding notification, otherwise they cached data, in fact, the old data is invalid, there may be various risks.

2) based on the data version, also known as optimistic lock. To take the data at will, take the past, by the current version, if you want to write, no problem, the previous version of the data to get back. DB will check the version, and the current version of the match to be able to write, at the same time the version number increment, or throw aside directly. Obviously, this can bring higher concurrency performance, but there are still defects, if the same logical operation involves multiple data modification, some success has failed, how to deal with it? Do you want to do business? Fart, have you seen a few games to do business AH?! Do you want to try again? Or write a log? When dealing with exceptional situations, the use of optimistic locking methods requires careful consideration. This is precisely the lock data can be well circumvented.

3) Single point modification. This is only a thought, the implementation of a number of ways, for example, the same player's interaction is limited to the same server, the ability to serialize the operation, and do not involve real-time player data interaction, through the mail or offline operation of the queue, to ensure that the same player's operation only in his own login server, It is also possible to serialize the operation.

Finally, the Lord also wants to put a fart, we are doing software, do not forget to look at the teaching materials, what? Computer architecture, Connaught, on this book:

<ignore_js_op>


It may be possible to get more inspiration from the way in which the CPU modifies the cache, memory, etc. and ensures consistency of data.

  related reading : service-side framework Dry Goods: the technical realization of fast-paced multiplayer games

Game Backstage Talk: The background language, system and architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.