SlideShare uma empresa Scribd logo
1 de 54
INSIDE THE IT TERRITORY
GAME SERVER
Mark Lokshin
Senior programmer
WE TALK ABOUT
•Technology stack
•Update specialty
•Game cluster structure
•Performance
• 200+
employees
• 15+
successful
projects
• 100+ millions
players
Out studio
IT TERRITORY
•Allods Online
•Hawk: Freedom Squadron
•Space Justice
•World Above
•Rush Royale
TECHNOLOGY STACK
IN THE BEGINNING THERE WAS
SILENCE AND DARKNESS
• 2007 year
• Pure Java SE
• Proprietary protocol
• Proprietary API
• Hibernate, GWT, Trove collections,
Protobuf …
INTERESTING, BUT
NOT EFFECTIVE
• Code generation, change byte-code on
a fly
• No documentation
• No best-practice examples
• Stack Overflow Driven Development
• Need functionality - do it
• Hard to support
WHAT ARE WE USE?
• PostgreSQL
• Photon Cloud
• Kafka
• Hazelcast
• Vert.X
• Prometheus + Grafana
•Game mechanics
•Actions verification
PHOTON CLOUD
• «Rooms» for the game
• Datacenters in X point on all
continents (penguins offended)
• Dynamic hardware reservation
• Made for games, but useful not only
for games(f.e. – text/sound/video
chat)
•Persistence layer
•Logging system
APACHE KAFKA
• Horizontal scaling
• Message persistence
• Replication
Distributed message broker
•Persistence layer
•Game mechanics
•Metagame
HAZELCAST
• Integrate in Vert.X
• Cluster from the box
• Load balancing
• Horizontal scaling
• Add/failure node support
• Distributed data structures
• Queries
In memory Data Grid
•Matchmaking
•Game mechanics
•Metagame
•Actions verifications
•Chat
•Mail
•Payments
VERT.X
• Open-source framework for
building distributed event-driven
applications based on JVM
• Verticle – single thread service
• Distributed message bus
• Asynchrony
• Parallelism
• Multilanguage
REACTOR PATTERN
OPERATION EXECUTOR
• Define entities for work (and
specify lock level to access)
• Take required locks
• Retrieve required entities from
Hazelcast
• Execute operation code
• Send changed entities to
Hazelcast
• Remove locks
• Run callback when finish operation
DEADLOCK WHILE
BLOCKING
• Operation 1 take lock on A
resource
• Operation 2 try to take lock on A
resource and wait
• Operation 1 try to take lock on B
resource
• … and unfortunately deadlock
SOMEWHERE INSIDE VERT.X
• T1:Lock(A)
• T2:Lock(A)
• T1:Lock(B)
T1:A
T2:A
T1:B
Locks queue
DEADLOCK WHILE
BLOCKING
• https://groups.google.com/g/vertx/c/-
uvLMuubpz8/m/OB2JzdDdAwAJ
• https://github.com/vert-x3/vertx-hazelcast/issues/41
AUTHORS REASONS
The original reason executeBlocking defaults to
ordered=true (it's more general than just hazelcast usage)
is something like this:
Imagine you have a web application and request #1 comes
in - this requests inserts some data into a database (e.g.
add to shopping basket)
Immediately after this requests #2 comes in - this selects
the same data from the database (e.g. view shopping
basket)
VERT.X STRESS TESTING
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• Everything is very bad…
VERT.X STRESS TESTING
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• Everything is very bad…
• DB??? Remove interaction with database
VERT.X STRESS TESTING
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• Everything is very bad…
• DB??? Remove interaction with database
• Everything is very bad …
VERT.X STRESS TESTING
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• Everything is very bad…
• DB??? Remove interaction with database
• Everything is very bad …
• Continue to test performance in different configurations
VERT.X STRESS TESTING
• We developed test server, that performs one operation
• We developed client, that sends one operation to the
server.
• Testing performance in different configurations
• Everything is very bad…
• DB??? Remove interaction with database
• Everything is very bad …
• Continue to test performance in different configurations
• Everything is very bad … but sometimes good…
VERT.X STRESS TESTING
PROMETHEUS + GRAFANA
«RAISE» INSIDE VERT.X
WHEN CREATING A
CHANNEL
• Code take locks when user create new channel inside
Vert.X
• If you create many channels at same time – code wait
most of time inside locks
• We create one channels per user – in case of large
users number the creation of channels was very slow
• We change channels schema to one channel per
message type
• We fix channel creation in Vert.X
• Create pull request to work Vert.X + Prometheus
TIM FOX
UPDATE FEATURES
GAME UPDATES
• Downtime min
• Development price min
• Revenue max
Business requirements
UPDATE PROCESS
• Delaying update availability
• Shards with different versions
• Unified database
• «Soft» update
• «Hard» update
SWITCHING PLAYERS TO
THE NEW VERSION
GAME CLUSTER STRUCTURE
GAME SHARD
Frontend
Mechanics[N]
Local cache
Hazelcast
Frontend
Mechanics[M]
Local cache
…
=
Shard
PROJECT INFRASTRUCTURE
Hazelcast
Shard 1 Shard 2 Shard 3
Account Server
Kafka
ETL
Gametool Web Server
Gametool
Lobby
Account
STRUCTURES IN
HAZLECAST
Inside game shard (player information)
• Player description
• Player items
• Player quests
• Player counters
• e.t.c.
PlayerI
D
1
2
3
СТРУКТУРЫ В
HAZLECAST
Общий для шардов (например -
турнир)
PlayerI
D
1
2
3
• Battle history
• Battle history
• Battle history
№
bucket
1
2
3
• Players
• Scores
• Attempts
PlayerID
№
bucket
1 1
2 1
3 2
Players
counter 3
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
• Ticket from support – users see x2 players inside
tournament buckets.
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
• Ticket from support – users see x2 players inside
tournament buckets.
• Fix counter
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
• Ticket from support – users see x2 players inside
tournament buckets.
• Fix counter
• Check code for errors – nothing suspect
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
• Ticket from support – users see x2 players inside
tournament buckets.
• Fix counter
• Check code for errors – nothing suspect
• Remember, that some times before we shutdown
old node.
REPEATABLE COUNTER
• We made tournament, it works fine for a month,
players are registered and playing.
• Ticket from support – users see x2 players inside
tournament buckets.
• Fix counter
• Check code for errors – nothing suspect
• Remember, that some times before we shutdown
old node.
• Read documentation…
REPEATABLE COUNTER
• IAtomicLong have only 2 copy
• When 2 copies lay in old nodes for shutdown, there
was a problem
• Shutdown node with kill -9 – bad idea!
PERFORMANCE
50K ACTIVE USERS
• Game Servers: 2x8 2.5GHz Xeon + 32Gb
RAM x3
• GameDB Server: 2x4 2.5GHz Xeon + 256Gb
RAM
• Account Server: 2x4 2.5GHz Xeon + 4Gb
RAM
50K ACTIVE USERS
• Game Servers: 2x8 2.5GHz Xeon + 32Gb
RAM x3
• GameDB Server: 2x4 2.5GHz Xeon + 256Gb
RAM
• Account Server: 2x4 2.5GHz Xeon + 4Gb
RAM
• AccountDB Server
• Kafka
• ETL
SCALING CAPABILITIES
• CPU – horizontal scaling hardware
in cluster
• БД – vanilla PostgreSQL → no
sharding → better hardware
• Write in IMDG, delayed sync with
PostgreSQL
• Different shards
CONCLUSIONS
• The technology stack scales
well and really works
• Errors happens
• Universalism is good, but not
for all purposes
MARK LOKSHIN
m.lokshin@corp.mail.ru
Senior programmer
THANK YOU!

Mais conteúdo relacionado

Mais procurados

Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade Workflow
Pantheon
 

Mais procurados (12)

Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
 
Getting Started With Jenkins And Drupal
Getting Started With Jenkins And DrupalGetting Started With Jenkins And Drupal
Getting Started With Jenkins And Drupal
 
Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - Deploy
 
Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)Drupal Continuous Integration (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
 
Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade Workflow
 
CommandBox & ForgeBox Package Management
CommandBox & ForgeBox Package ManagementCommandBox & ForgeBox Package Management
CommandBox & ForgeBox Package Management
 
Automate Thyself
Automate ThyselfAutomate Thyself
Automate Thyself
 
Wilko Nienhaus - continuous delivery release the right thing, done right, at ...
Wilko Nienhaus - continuous delivery release the right thing, done right, at ...Wilko Nienhaus - continuous delivery release the right thing, done right, at ...
Wilko Nienhaus - continuous delivery release the right thing, done right, at ...
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 

Semelhante a Inside the IT Territory game server / Mark Lokshin (IT Territory)

Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Ontico
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
slantsixgames
 

Semelhante a Inside the IT Territory game server / Mark Lokshin (IT Territory) (20)

Maximize Your Production Effort (English)
Maximize Your Production Effort (English)Maximize Your Production Effort (English)
Maximize Your Production Effort (English)
 
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
 
Supersize Your Production Pipe
Supersize Your Production PipeSupersize Your Production Pipe
Supersize Your Production Pipe
 
Massively Social != Massively Multiplayer
Massively Social != Massively MultiplayerMassively Social != Massively Multiplayer
Massively Social != Massively Multiplayer
 
Working Well Together: How to Keep High-end Game Development Teams Productive
Working Well Together: How to Keep High-end Game Development Teams ProductiveWorking Well Together: How to Keep High-end Game Development Teams Productive
Working Well Together: How to Keep High-end Game Development Teams Productive
 
Designing a Highly Available Environment Using Methods of Modern IT Infrastru...
Designing a Highly Available Environment Using Methods of Modern IT Infrastru...Designing a Highly Available Environment Using Methods of Modern IT Infrastru...
Designing a Highly Available Environment Using Methods of Modern IT Infrastru...
 
Virtualization: A Case Study from the IT Trenches - Darren Schoen, Broward Ce...
Virtualization: A Case Study from the IT Trenches - Darren Schoen, Broward Ce...Virtualization: A Case Study from the IT Trenches - Darren Schoen, Broward Ce...
Virtualization: A Case Study from the IT Trenches - Darren Schoen, Broward Ce...
 
[Start] Playing
[Start] Playing[Start] Playing
[Start] Playing
 
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
 
[NetherRealm Studios] Game Studio Perforce Architecture
[NetherRealm Studios] Game Studio Perforce Architecture[NetherRealm Studios] Game Studio Perforce Architecture
[NetherRealm Studios] Game Studio Perforce Architecture
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
 
Igniting the Spark: Building Online Services for Borderlands 2
Igniting the Spark: Building Online Services for Borderlands 2Igniting the Spark: Building Online Services for Borderlands 2
Igniting the Spark: Building Online Services for Borderlands 2
 
Making an independend MMO - The Albion Online Story
Making an independend MMO - The Albion Online StoryMaking an independend MMO - The Albion Online Story
Making an independend MMO - The Albion Online Story
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
Sergey Dzyuban "To Build My Own Cloud with Blackjack…"
Sergey Dzyuban "To Build My Own Cloud with Blackjack…"Sergey Dzyuban "To Build My Own Cloud with Blackjack…"
Sergey Dzyuban "To Build My Own Cloud with Blackjack…"
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons LearnedPerformance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons Learned
 
2013-cloudconnect-OpenStack@BT
2013-cloudconnect-OpenStack@BT2013-cloudconnect-OpenStack@BT
2013-cloudconnect-OpenStack@BT
 
Fixing twitter
Fixing twitterFixing twitter
Fixing twitter
 

Mais de DevGAMM Conference

Mais de DevGAMM Conference (20)

The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...
 
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
 
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
 
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
 
AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)
 
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
 
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
 
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
 
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
 
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
 
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
 
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
 
How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...
 
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
 
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
 
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
 
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
 
Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...
 
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
 
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Inside the IT Territory game server / Mark Lokshin (IT Territory)

  • 1. INSIDE THE IT TERRITORY GAME SERVER Mark Lokshin Senior programmer
  • 2. WE TALK ABOUT •Technology stack •Update specialty •Game cluster structure •Performance
  • 3. • 200+ employees • 15+ successful projects • 100+ millions players Out studio
  • 4. IT TERRITORY •Allods Online •Hawk: Freedom Squadron •Space Justice •World Above •Rush Royale
  • 6. IN THE BEGINNING THERE WAS SILENCE AND DARKNESS • 2007 year • Pure Java SE • Proprietary protocol • Proprietary API • Hibernate, GWT, Trove collections, Protobuf …
  • 7. INTERESTING, BUT NOT EFFECTIVE • Code generation, change byte-code on a fly • No documentation • No best-practice examples • Stack Overflow Driven Development • Need functionality - do it • Hard to support
  • 8. WHAT ARE WE USE? • PostgreSQL • Photon Cloud • Kafka • Hazelcast • Vert.X • Prometheus + Grafana
  • 10. PHOTON CLOUD • «Rooms» for the game • Datacenters in X point on all continents (penguins offended) • Dynamic hardware reservation • Made for games, but useful not only for games(f.e. – text/sound/video chat)
  • 12. APACHE KAFKA • Horizontal scaling • Message persistence • Replication Distributed message broker
  • 14. HAZELCAST • Integrate in Vert.X • Cluster from the box • Load balancing • Horizontal scaling • Add/failure node support • Distributed data structures • Queries In memory Data Grid
  • 16. VERT.X • Open-source framework for building distributed event-driven applications based on JVM • Verticle – single thread service • Distributed message bus • Asynchrony • Parallelism • Multilanguage
  • 18. OPERATION EXECUTOR • Define entities for work (and specify lock level to access) • Take required locks • Retrieve required entities from Hazelcast • Execute operation code • Send changed entities to Hazelcast • Remove locks • Run callback when finish operation
  • 19. DEADLOCK WHILE BLOCKING • Operation 1 take lock on A resource • Operation 2 try to take lock on A resource and wait • Operation 1 try to take lock on B resource • … and unfortunately deadlock
  • 20. SOMEWHERE INSIDE VERT.X • T1:Lock(A) • T2:Lock(A) • T1:Lock(B) T1:A T2:A T1:B Locks queue
  • 22. AUTHORS REASONS The original reason executeBlocking defaults to ordered=true (it's more general than just hazelcast usage) is something like this: Imagine you have a web application and request #1 comes in - this requests inserts some data into a database (e.g. add to shopping basket) Immediately after this requests #2 comes in - this selects the same data from the database (e.g. view shopping basket)
  • 23. VERT.X STRESS TESTING • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations
  • 24. • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations • Everything is very bad… VERT.X STRESS TESTING
  • 25. • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations • Everything is very bad… • DB??? Remove interaction with database VERT.X STRESS TESTING
  • 26. • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations • Everything is very bad… • DB??? Remove interaction with database • Everything is very bad … VERT.X STRESS TESTING
  • 27. • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations • Everything is very bad… • DB??? Remove interaction with database • Everything is very bad … • Continue to test performance in different configurations VERT.X STRESS TESTING
  • 28. • We developed test server, that performs one operation • We developed client, that sends one operation to the server. • Testing performance in different configurations • Everything is very bad… • DB??? Remove interaction with database • Everything is very bad … • Continue to test performance in different configurations • Everything is very bad … but sometimes good… VERT.X STRESS TESTING
  • 30. «RAISE» INSIDE VERT.X WHEN CREATING A CHANNEL • Code take locks when user create new channel inside Vert.X • If you create many channels at same time – code wait most of time inside locks • We create one channels per user – in case of large users number the creation of channels was very slow • We change channels schema to one channel per message type • We fix channel creation in Vert.X • Create pull request to work Vert.X + Prometheus
  • 33. GAME UPDATES • Downtime min • Development price min • Revenue max Business requirements
  • 34. UPDATE PROCESS • Delaying update availability • Shards with different versions • Unified database • «Soft» update • «Hard» update
  • 38. PROJECT INFRASTRUCTURE Hazelcast Shard 1 Shard 2 Shard 3 Account Server Kafka ETL Gametool Web Server Gametool Lobby Account
  • 39. STRUCTURES IN HAZLECAST Inside game shard (player information) • Player description • Player items • Player quests • Player counters • e.t.c. PlayerI D 1 2 3
  • 40. СТРУКТУРЫ В HAZLECAST Общий для шардов (например - турнир) PlayerI D 1 2 3 • Battle history • Battle history • Battle history № bucket 1 2 3 • Players • Scores • Attempts PlayerID № bucket 1 1 2 1 3 2 Players counter 3
  • 41. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing.
  • 42. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing. • Ticket from support – users see x2 players inside tournament buckets.
  • 43. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing. • Ticket from support – users see x2 players inside tournament buckets. • Fix counter
  • 44. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing. • Ticket from support – users see x2 players inside tournament buckets. • Fix counter • Check code for errors – nothing suspect
  • 45. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing. • Ticket from support – users see x2 players inside tournament buckets. • Fix counter • Check code for errors – nothing suspect • Remember, that some times before we shutdown old node.
  • 46. REPEATABLE COUNTER • We made tournament, it works fine for a month, players are registered and playing. • Ticket from support – users see x2 players inside tournament buckets. • Fix counter • Check code for errors – nothing suspect • Remember, that some times before we shutdown old node. • Read documentation…
  • 47. REPEATABLE COUNTER • IAtomicLong have only 2 copy • When 2 copies lay in old nodes for shutdown, there was a problem • Shutdown node with kill -9 – bad idea!
  • 49. 50K ACTIVE USERS • Game Servers: 2x8 2.5GHz Xeon + 32Gb RAM x3 • GameDB Server: 2x4 2.5GHz Xeon + 256Gb RAM • Account Server: 2x4 2.5GHz Xeon + 4Gb RAM
  • 50. 50K ACTIVE USERS • Game Servers: 2x8 2.5GHz Xeon + 32Gb RAM x3 • GameDB Server: 2x4 2.5GHz Xeon + 256Gb RAM • Account Server: 2x4 2.5GHz Xeon + 4Gb RAM • AccountDB Server • Kafka • ETL
  • 51. SCALING CAPABILITIES • CPU – horizontal scaling hardware in cluster • БД – vanilla PostgreSQL → no sharding → better hardware • Write in IMDG, delayed sync with PostgreSQL • Different shards
  • 52. CONCLUSIONS • The technology stack scales well and really works • Errors happens • Universalism is good, but not for all purposes