Thread: what is the prefered way to to work with user info?

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    111

    what is the prefered way to to work with user info?

    hello ,..
    as a second year project in SE me and few friends took a projoct of 3d game .
    on the server side:

    what is the preffered way to work with user info we took the next scheme but i guess that there is a better way .

    on the server there is :
    mysql server.
    game server application.

    in the server there is 1 mb array for users and ids.
    the game_server recives a connection and create new thread that checks the request:
    if this is read_request it takes if it is postion request it takes from the array and return data.
    if this a write_request for postion it it update the array and start a new thread that will update the sql server.

    if this a read_request for function it just open new thread for the sql_request .
    if this a write_request for function it lock and update the spesific line in the data base.

    my question are :
    is it a proper approach to create a cache for the often called functions or it is better just to use the sql server.

    also what do you about our approach for the data processing (using threads and not making one long que).
    why Gaos didn't had a wife ?
    http://bsh83.blogspot.com

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have no idea on the specifics of what you are asking, but as a general rule, you only create caches or such types of "duplicating data to make access faster" if they really are causing a performance problem - so I'd say "try without caching", but make sure you isolate the database accesses in such a way that you can easily plug in a caching function later on if you need to - in ohter words, make sure that all database accesses are done in small simple functions that does just that, rather than scattering a bunch of sql requests all over the code.

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Factorial
    By foxman in forum Contests Board
    Replies: 27
    Last Post: 07-11-2008, 06:59 PM
  2. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  3. Style Points
    By jason_m in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 06:15 AM
  4. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 03:53 PM
  5. sorting output on student info program
    By indigo0086 in forum C++ Programming
    Replies: 2
    Last Post: 11-05-2002, 11:29 AM