View Single Post
Old 09-21-2011, 09:02 AM  
idogfy
Registered User
 
Industry Role:
Join Date: Sep 2011
Posts: 12
Well, what would you append? I'm curious of your strategy

But locking or not, if traffic is a problem so that querying a DB would hit the server, my experience tell me having a single SPOF with one file, will be an equivalent bottleneck (if not worse in fact) even if you don't lock...you still need to actually write the file and the equivalent number of DB connection are translating into file write...(with all concurrent thread and/or process fighting against each other)

memcached (for example) is very well suited for counters but this just my 2 cents
and other client side and/or 3rd solution like Google Analytics / URL Shortener for sure solve the scalability problem by giving the problem to someone else


I'm also interested to understand how you don't lock? my understanding is that by the time you open the file in append mode, and the time you write to the file with the pointer at what you believe is the end of the file, you may very well have a race condition where in between the two instructions, some else open the file...the first append and bump the second who wants to append has the pointer not at the end of the file due to the previous write.
What am i missing here?

I'm interested to see your idea and way of doing that from a technical point of view since this would open new ideas for me, thanks.
What is your strategy, what do you append and how do you update after?
idogfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook