Hello,

I'm writing a real-time multi-player strategy game with a Perl back-end. It works quite nicely, but I suspect a potential performance issue under higher traffic (right?). My search to improve things led me to mod_perl which is great because I really like Perl and UNIX!

I heard that memory access was some 1000x faster than disk access, so my idea is to use mod_perl to store some of the high traffic information about the client (availability, for example) in a shared memory space instead of writing this data to files on disk and reading it back when needed (as currently implemented). Ideally, the shared data (a hash table) would be readable and writable by multiple scripts sent from different clients. So, ping.pl would return the value of a specific key in the hash table and exit.pl would clear your key, etc.

The Eagle Book says you can store small amounts of state information in main memory with IPC::Sharable. Just how much is a small amount? I would expect a hash of several hundred keys to potentially many thousands of them (all with most likely just a small amount of data). Is IPC::Sharable going to be the right choice? They seem to lean towards a SQL Database solution for lots of information for a long duration (I may not need a long duration). How fast is this compared to shared memory and regular file access (my current method)? Is the database held in memory, on disk, or both? Maybe everything should go in a MySQL database if it offers superior performance? Speed is my primary objective, followed by efficiency.

Also, any idea on how many people could be on a single dedicated server this way at one time before the server gets maxed out?

Thanks 1000x for any answers, pointers or recommendations,
:-Dev

In reply to speeding up multi-player game with shared memory or MySQL by dev2000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.