I'm working on an online turn-based game. I will have a server, but it will be used strictly for storing match data and relaying it to the match's participants (or spectators). For simplicity, no game logic will be processed in the server and the participants will be the ones to decide the legality of the enemy's moves etc.
My backend cloud knowledge is limited. I can work fine with PHP and MySQL, so I can technically make a PHP API, host it, and have the players poll it via HTTP requests every few seconds to get updates on the match (or upload commands). The PHP script will always open a MySQL connection, do one or two small queries and return a tiny bit of JSON-formatted data. To summarize, I believe that a single request would take at most 2 seconds to complete, and the output will be usually less than 100 bytes.
Given this fact, I figured I could perhaps try one of those serverless cloud functions services, like Azure's. It sounds just perfect for my kind of scenario.
For this project, I am estimating at most 100 users playing a match at any given time. And given the way the game is designed, they should probably poll data every two seconds. So 100 * 30 * 24 * 60 * 30 = ~130M
executions per month. With Azure, that could be around $540 monthly just to support about 100 players.
This got me thinking, what if I just host the PHP API and MySQL database in a normal VPS, like GoDaddy's perhaps? Their cheapest option is about $50 a month. They don't meter the number of requests, concurrent users or bandwidth used (my usage is pretty low anyway, less than 15GB monthly).
So my question is, how come a 'serverless function' service is massively more expensive than just using a normal VPS to host my PHP API? Is there a catch that I may be missing?
Naturally it's all about testing - I should try both of them, but I figured someone has been through this already, or perhaps there is something obvious I am missing.