Can I do blocking in RequestFiber?

Options
UltimaWeapon
edited August 2012 in Photon Server
Hi, I have a question. Can I do blocking in a function that get called by RequestFiber? Like Sleep or wait for some objects to be signaled. My game is a real-time. I have concern about available thread for processing RequestFiber of other client. When all thread is get blocked, What will happened?

My game is using SQL Server. It need to wait until query is completed. If I use asynchronous, Photon will processing next operation immediately after returned from OnOperationRequest.

Sorry for my English. Thank you.

Comments

  • The peer's RequestFiber is a PoolFiber: "Fiber that uses a thread pool for execution." So blocking that thread should not effect or block other peers. Unless every thread in the pool gets blocked. That's my understanding anyways :D

    Another approach instead of blocking is to use fiber.Enqueue() to submit an action, and then raise an event later to the peer(s) after that action is processed. Then you can send the peer an OperationResponse immediately, acknowledging that the op request is submitted.

    But if you are aiming for realtime, then using async calls to SQL Server sounds like it would be more performant. Cant offer any advice there.

    Hope this helps- I'm pretty new here myself. Your English is fine, by the way.
  • Thanks mindlube, you are correct about the PoolFiber.

    It depends a bit on your requirements, but in many cases, it is a viable alternative to create a separate web service that handles the database stuff, so that your game client calls that web service for operations that handle persistent data (like authorization, highscore uploads, you name it), and use Photon only for the real-time action. Maybe that's a simpler option for you.
  • Thanks mindlube and Nicole. Finally I have chooses to go with Enqueue() + Asynchronous SQL.