FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Test race condition? (unit test?)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Test race condition? (unit test?) [message #175593 is a reply to message #175589] Mon, 10 October 2011 17:42 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/10/2011 9:48 AM, Simon wrote:
>>
>> The real question here is - what is the problem you're trying to
>> resolve. Without knowing that, it's difficult to recommend if there is a
>> better way.
>>
>
> Thanks for the reply. I am not trying to solve a problem per say.
> I am 'just' trying to prevent duplicate work.
>
> When a request for a certain page first comes, it make a few calls to
> the db and then caches the page.
> Once the page is cached, only one call needs to be made.
>
> But I sometime get hundreds of calls for a certain page, all at the same
> time.
> So it would make no sense for all of them to create the very same cache
> page.
>
> It makes more sense for the first request to cache the page wile others
> wait a few milliseconds for it.
> By locking the page, the first requests is instructing others that the
> work is already been done and they should wait a few milliseconds.
>
> Every so often, (for various reasons), the cache is marked as 'dirty'
> and a new cache will then be recreated.
> If one request 'locks' the page, and a cache is available, then the
> other requests will continue to serve the dirty page.
>
> I just want to prevent the same cache been created by many requests at
> the same time.
>
> I hope this makes sense.
>
> Simon

Are you sure you need this? Databases will cache the results and future
db requests for the same information are generally quite fast.

Are you having performance problems? And if so, have you looked at
where your performance problems are? And if so, have you tried to
optimize your code?

Depending on what's going on, trying to cache pages can actually add
overhead to the server instead of relieving it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Anyoen actively on here?
Next Topic: .htaccess vs PHP header(location:)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 01:28:14 GMT 2024

Total time taken to generate the page: 0.05218 seconds