HQ Trivia attracts millions of players every day and a lot of our customers ask the question “What is the architecture behind HQ Trivia?”
Let’s try to uncover the mystery in this blog post. I won’t go into very technical details, the goal is to give an overview. So why not to take the easiest way and check HQ Trivia “Job Opening”, specifically they are looking for Senior Backend Engineer
Obviously, HQ Trivia job opening doesn’t reveal all details, so let’s add some guesses.
Node.JS need to save data to relational Database, most popular options are PostgreSQL or MySQL. They are similar without big differences, so let it be PostgreSQL.
Next important factor that many providers of “HQ Trivia clone” platforms forget is system ability to scale. When you have one million players clicking the button at the same time that’s a huge load on the system. Achilles heel in the architecture is the Relational Database that physically can’t make one million data savings in a very short period of time.
Question of the day: How to handle that load? They are different options available, let’s assume HQ Trivia use in-memory database like Redis. So Redis can sit in between users and PostgreSQL, aggregate data and eventually save it over the time to PostgreSQL.
Further up the agenda we got mobile applications. What technologies does “HQ Trivia” use?
And that is Not Unity. Why not? Because there is no clear way on how to make low delay video streaming to Unity. If someone propose you to use Unity with video streaming apps, ask them to make a demo first and show that the system can stream with sub-second delay.
Recently we got a customer with Unity mobile app who has a complete system with one “minor glitch” – video streaming doesn’t work. We managed to “fix” it but video streaming delay is 2.5 seconds, which is not the best option for a Trivia game.
Usually, companies use so-called “native” technologies for mobile applications: Java for Android, Swift for Apple devices. And also HQ Trivia has another job opening for Android engineer.
Next part is a web application for the Host to run the show. That could be done in React.JS or Angular, not a big deal.
Now let’s talk about video streaming.
HQ Trivia need to stream to millions of users without glitches and delays. There are few video streaming solutions that potentially are able to handle that. And please forget about open sources like Kurento or Jitsi. We tested Red5Pro and it works. Maybe Wowza can handle that too. What HQ Trivia is using no one knows, but since it is a relatively young company I assume they don’t have custom solutions and use something ready from the box like Red5Pro or Wowza.
But again, before buying the video streaming system, ask the vendor to prove an ability to scale and handle all players simultaneously with minimum delays. It is super important!
Finally, we got to the last chapter which is “Cloud”. Market leaders are Amazon AWS, Google Cloud, Microsoft Azure. HQ Trivia use Amazon AWS, but it’s hard to make a mistake here, each and every cloud, mentioned above, will do the job.
Last keywords from the job opening are Terraform and Kubernetes. One game for HQ Trivia could use 100 or more servers easily and engineers need to control that “zoo”. Terraform and Kubernetes help development operations engineers to deploy the platform to servers in the cloud with a click of a button.
That’s it! Hopefully, I was able to lighten technologies behind HQ Trivia.