Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Ranking System Caching

Joined
Sep 16, 2007
Messages
1,206
Reaction score
541
Hi guys, i would like to ask if someone already done this, I'm just a novice on PHP Coding, i hope someone can help me about this :scared:

It takes too much usage when using real time rankings system ( always loading character info whenever a visitor visits the rank page ) .

Is there anyone has this system? Can you please give me tip how to cache rankings? For example, rankings refresh every 12 or 24hrs.. TIA :thumbup:
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
899
I would suggest generating a output file on your server every 12/24 hours and just read it's content and display it. (ofc with the information). Simple solution if the data isn't going to change for a while.
 
☮TAKU????
Loyal Member
Joined
Nov 16, 2009
Messages
866
Reaction score
580
You could use XCache and make a OO Wrapper
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
Phil Karlton said:
There are only two hard problems in computer science: Cache invalidation and naming things"

How are you loading the information? Do you load the rank information from a database every time it is requested? If so, what kind of database (MySQL- some other relational database/some noSQL variant/some kind of flat-file database?

Explain what you mean by "real-time" and how it works for your system. For example, are you using AJAX with long-polling or web-sockets to keep information on a web-page up-to-date? Are you sending the data when it is changed, or on a time-interval regardless of the state of the data. How much data are you sending (estimate in bytes)?

@CodeDragon offered a data storage solution which involves file I/O to a problem that may already be faster than that. Without information, I can't say- though file I/O is relatively slow.. relative to other data storage techniques.

@oleaa said to use XCache, but from my understanding, XCache is not a data caching solution. XCache claims to make PHP execute faster by saving the compiled state of PHP files in memory. If you are loading the data from a database, than the database I/O is likely the bottleneck. XCache is probably good to use anyway, but I don't think XCache will solve your problem.

It's easy to throw data in memory and send it to a web-page, the hard part is knowing when to take the data out of memory, and teaching the computer when it should/shouldn't store the data in the first place. (as noted in the quote- cache invalidation). Also, network I/O over the internet is one of the slowest forms of I/O there is. Decreasing requests/responses may attack the problem head on. You may not even need to cache that data on the server.

You seem to think that 12-24 hours is the right time to invalidate cache. Though I'm not entirely convinced. If you are not worried about anything except "Where" to store the cache, then the answer is very simple: The best place to store cache is memory. (Granted, the goal is that an appropriate amount of data is quickly stored and quickly retrieved).

If you need help with optimizing your system's procedures, which I believe is the real problem, please answer my questions.
 
Last edited:
☮TAKU????
Loyal Member
Joined
Nov 16, 2009
Messages
866
Reaction score
580
How are you loading the information? Do you load the rank information from a database every time it is requested? If so, what kind of database (MySQL- some other relational database/some noSQL variant/some kind of flat-file database?

Explain what you mean by "real-time" and how it works for your system. For example, are you using AJAX with long-polling or web-sockets to keep information on a web-page up-to-date? Are you sending the data when it is changed, or on a time-interval regardless of the state of the data. How much data are you sending (estimate in bytes)?

@CodeDragon offered a data storage solution which involves file I/O to a problem that may already be faster than that. Without information, I can't say- though file I/O is relatively slow.. relative to other data storage techniques.

@oleaa said to use XCache, but from my understanding, XCache is not a data caching solution. XCache claims to make PHP execute faster by saving the compiled state of PHP files in memory. If you are loading the data from a database, than the database I/O is likely the bottleneck. XCache is probably good to use anyway, but I don't think XCache will solve your problem.

It's easy to throw data in memory and send it to a web-page, the hard part is knowing when to take the data out of memory, and teaching the computer when it should/shouldn't store the data in the first place. (as noted in the quote- cache invalidation). Also, network I/O over the internet is one of the slowest forms of I/O there is. Decreasing requests/responses may attack the problem head on. You may not even need to cache that data on the server.

You seem to think that 12-24 hours is the right time to invalidate cache. Though I'm not entirely convinced. If you are not worried about anything except "Where" to store the cache, then the answer is very simple: The best place to store cache is memory. (Granted, the goal is that an appropriate amount of data is quickly stored and quickly retrieved).

If you need help with optimizing your system's procedures, which I believe is the real problem, please answer my questions.

XCache can store data (by variable name) into your RAM for fast access. I fetch my most common query results and store them into the cache so I don't have to connect to the database on all requests and reduce the queries called, which again will reduce the load on the server. Super useful for dynamic websites and websites like mine where I render images on the fly with certain values from the database.


http://forum.ragezone.com/f353/jontehs-cms-990161/#post8030015
 
Joined
Sep 16, 2007
Messages
1,206
Reaction score
541
How are you loading the information? Do you load the rank information from a database every time it is requested? If so, what kind of database (MySQL- some other relational database/some noSQL variant/some kind of flat-file database?

Explain what you mean by "real-time" and how it works for your system. For example, are you using AJAX with long-polling or web-sockets to keep information on a web-page up-to-date? Are you sending the data when it is changed, or on a time-interval regardless of the state of the data. How much data are you sending (estimate in bytes)?

@CodeDragon offered a data storage solution which involves file I/O to a problem that may already be faster than that. Without information, I can't say- though file I/O is relatively slow.. relative to other data storage techniques.

@oleaa said to use XCache, but from my understanding, XCache is not a data caching solution. XCache claims to make PHP execute faster by saving the compiled state of PHP files in memory. If you are loading the data from a database, than the database I/O is likely the bottleneck. XCache is probably good to use anyway, but I don't think XCache will solve your problem.

It's easy to throw data in memory and send it to a web-page, the hard part is knowing when to take the data out of memory, and teaching the computer when it should/shouldn't store the data in the first place. (as noted in the quote- cache invalidation). Also, network I/O over the internet is one of the slowest forms of I/O there is. Decreasing requests/responses may attack the problem head on. You may not even need to cache that data on the server.

You seem to think that 12-24 hours is the right time to invalidate cache. Though I'm not entirely convinced. If you are not worried about anything except "Where" to store the cache, then the answer is very simple: The best place to store cache is memory. (Granted, the goal is that an appropriate amount of data is quickly stored and quickly retrieved).

If you need help with optimizing your system's procedures, which I believe is the real problem, please answer my questions.

Hi, yes the rank loads every time someone requests it. I am using MsSQL. What i mean on "real time" is, whenever someone visits the rank page, it always displays the actual values from the database..
 
Back
Top