Lock keyword and Fiber

Options
locus84
edited November 2013 in Photon Server
Currently I'm implementing Database server with memory cache.

I made a dictionary which stores informations about player who once logged in.

Thus to control this dictionary without any multithread issues, I used lock keyword.

But according to google, It takes appox 20ns per each lock keyword.

I guess if there's a lot of users related in this dictionay, 20ns can be critical to performance.

Is it better to use PoolFiber than Lock keyword???

Btw, sorry for my bad English

Comments

  • chvetsov
    Options
    Hi,, locus84
    well, we did not do special tests
    you could create this your self very easly.

    i can say that i would prefer use fiber where it is possible, because they allow you program in single thread mode. This is much more easier
    if code does not allow use fibers, then use locks.

    Another option could be use ReadWriteLocks. if you have many readers this may have sense
  • Thank you for fast reply, I've searched about readwritelockslim, and think it fits on my project!
    Ty again!

    P.s I saw on of you in G-Star 2013, was very glad to meet! bravo photon! Cant wait to meet upcomming features!