Heavy php operations in an http request, realistic? (creating lots of objects etc)
<p>I developed a board game app (for android/iphone) and added a multiplayer component to it. Was thinking of using app engine (java) for the backend, so implemented that way, but turns out the cpu costs are probably going to be too high (app engine is probably not the best choice for this sort of app).</p>

<p>I don't have much experience with php's performance, am wondering if anyone can give me an idea if I'm heading down a bad path translating it to php. Basic steps would be:</p>

<ol>
<li>Http request is made to my server, player is trying to perform a move (it's a turn-based game).</li>
<li>Fetch game state from database. This will probably be stored as a flat json string (there's not much point to creating a schema for the gamestate).</li>
<li>Deserialize json string into workable gamestate objects (like houses, cars, etc).</li>
<li>Perform gamestate manipulations finally (like moving the player's car to a new house etc).</li>
<li>Serialize modified gamestate, persist back to database.</li>
<li>Send json response back to player, which will contain updated gamestate.</li>
</ol>

<p>I don't know if that's a lot of work to try doing in the context of a single http operation. Some numbers:</p>

<ol>
<li>Expecting about 500 players using the service at any given time.</li>
<li>Each game consists of only 2 to 8 players, each game is completely independent.</li>
<li>The json gamestate object is about 25k in size when serialized.</li>
<li>The json gamestate object will have to deserialize about 300 objects to restore the complete state of the game (houses, cars, etc).</li>
</ol>

<p>Is this unrealistic? The best solution I think would be to get a dedicated server, and just leave all the gamestates in memory, but I'm trying to get by with some of the shared hosting platforms for now. This means I have to keep going back and forth to the database to get gamestate, deserializing and serializing.</p>

<p>Thanks for any thoughts</p>
