13
Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Embed Size (px)

Citation preview

Page 1: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Applying Database Replication to Multi-player Online Games

Yi LinBettina Kemme

Marta Patiño-Martínez Ricardo Jiménez-Peris

Oct 30, 2006

Page 2: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Outline

• Motivation– Requirements of MOGs– Benefits of database replication

• Introduction to database replication

• A proof-of-concept game

• Experiments

Page 3: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

What MOGs need?

• Fault tolerance

• Scalability

Isolated game worlds

Page 4: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

What Database Replication does?

• Providing fault tolerance

• Scalability

• Data consistency

ReadOne DB

Write All DBs

•Most replication protocols are READ-ONE-WRITE-ALL

Page 5: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Motivation

• Why don’t we apply database replication to MOGs?

• Unclear about– How to apply?– What are the challenges?– How is the performance?

• Using a small game for proof-of-concept

Page 6: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Introduction to Database Replication

• Transaction– A transaction contains one or more read and/or write

requests– Atomic.

• Commit: all requests successful.• Abort: none of writes will take effect

– Consistent– Isolated– Durable

• Challenge of database replication:– How to guarantee data consistency in terms of

transaction?

Page 7: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Database Replication: challenge

w(x) w(x)

• Ideally: The whole system behaves as if there is one database

xx xx xx

Replica control

• Replication protocols •Keep copies consistent• Isolate concurrent transactions

Page 8: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

SEQ Replication Protocol

x x

r(x) r(x)commit commitw(x) w(x)

Extract writeset Extract writeset

T1 T2

x x

abort

JDBC JDBC

Sequencer

T1 T2validationvalidationfailsucceed

apply ws, commitcommit

Page 9: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Other replication protocols

• Lazy Primary– Limitation: Need to know if

a transaction is read-only or not in advance

• Symmetric– Limitation: Need to know all

operations in a transaction in advance

• SRCA-REP– Need support of group

communication systems• We build a middleware

platform, MiddleSIR, to accommodate all these protocols.

JDBC JDBC

Comm Mgr

Txn Mgr

Conn Mgr

Comm Mgr

Txn Mgr

Conn Mgr

Page 10: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

A proof-of-concept game

• Modeling based on transactions

• E.g., two players might type same string concurrently. – Model: Typing a string as one

transaction, while typing a character as an operation

• E.g., All players see the same game interfaces– Model: Periodically reading

data (e.g., strings, bullets, scores) from database as one transaction.

Page 11: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Experiments in WANs, Scalability

Page 12: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Experiments in WANs, 4 servers, Write transactions

Page 13: Applying Database Replication to Multi-player Online Games Yi Lin Bettina Kemme Marta Patiño-Martínez Ricardo Jiménez-Peris Oct 30, 2006

Conclusion

• Propose a new approach of system supports for MOGs– Applying database replication to MOGs for fault

tolerance, scalability, performance, ease of concurrency control

• Use a small game for proof-of-concept– Data consistency is guaranteed– Response time is good, even in WANs.– Scalability is not good.

• Read-one / Write-All replication only scales if the percentage of reads is very high.

• Future work: use partial replication (Write only a few servers)