Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

mysql - What's the most scalable way to track user activity? -


i track user activity , limit activity using time constraint. example of votes per day limit enforced so. of following methods provides better solution in terms of scalability , ease of use?

  • store activity info in database
  • store activity info in application scope
  • use entirely different method track information

method 1:

  • advantages: data integrity, not important in use case.
  • disadvantages: requires database interaction, stores redundant data, requires scheduled event reset values being tracked

method 2

  • advantages: not require database interaction, appears easier
  • disadvantages: i'm unsure of implications on application memory given large user-base track, or how easy find , manipulate struct data hundreds of keys

i'm using coldfusion mysql, if matters.

assuming care data on per-person basis, , won't getting aggregates of this, i'd suggest go key/val store supports ttl. redis sounds fits requirements pretty well.

  • though runs in memory, snapshot disk periodically (which mean it's fast, , if goes down, you'll back).

  • easy interaction, "method 2", without having worry managing large in-memory structure.

example setup

going points-per-day scenario, we'll have time-frame of 1 day, , our value simple value increments on user activity.

our key combination of user's id , current timeframe (day, in case). after have set key, set ttl, means after today up, key expire , clean up.

redis> incr user123-2011-10-09 (integer) 1  # no value found key, defaulting 1              # if key had value incremented.  redis> expire user123-2011-10-09 86400 (integer) 1  # expiration of 1 day successful  redis> user123-2011-10-09 "1"          # current value of user key 

more info on these commands (incr, get, expire, , ttl of interest you) can found on redis commands reference (complete interactive shell try these things out).

edit

this method applied number of k/v stores, i've used redis here concrete example since believe meets requirements closely.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -