SlideShare una empresa de 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!

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar 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
 

Similar 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
 

Más de DevGAMM Conference

Más 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

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

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