Click here to Skip to main content
15,902,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: strtok - reconstruct string after it finds a token Pin
Renjith Ramachandran27-Dec-02 13:27
Renjith Ramachandran27-Dec-02 13:27 
QuestionWhere is random() in Visual C++.net ? Pin
HellShrimp4free27-Dec-02 9:52
HellShrimp4free27-Dec-02 9:52 
AnswerRe: Where is random() in Visual C++.net ? Pin
Nish Nishant27-Dec-02 10:00
sitebuilderNish Nishant27-Dec-02 10:00 
GeneralRe: Where is random() in Visual C++.net ? Pin
HellShrimp4free27-Dec-02 10:11
HellShrimp4free27-Dec-02 10:11 
GeneralRe: Where is random() in Visual C++.net ? Pin
S O S27-Dec-02 10:28
S O S27-Dec-02 10:28 
GeneralRe: Where is random() in Visual C++.net ? Pin
Nick Parker27-Dec-02 11:04
protectorNick Parker27-Dec-02 11:04 
AnswerRe: Where is random() in Visual C++.net ? Pin
UrbanBlues27-Dec-02 22:11
UrbanBlues27-Dec-02 22:11 
GeneralOptimizing a pooling mechanism... Pin
Matt Gullett27-Dec-02 9:29
Matt Gullett27-Dec-02 9:29 
I have a Windows NT service which maintains a pool of objects. The purpose of the pool is to improve performance because the objects being pooled require a signifigant amount of time for construction.

At any given time, there can be from 0-N requests for objects from the pool. There are times when the pool will have no requests at all for days. Other times, it will have 1000s of requests an hour/minute. I keep track of # of requests, avg time between requests, first request, last request, time to allocate, time to fill request, peak objects in pool, peak requests per sec/min, # of requests made when pool was exausted.

I am looking for an algorithm that will limit the number of requests that occur when the pool is exausted while not exceeding a maximum pool size or memory usage. There really is not MAX size, but I don't want to just allocate 1000s all the time. My goal would be to have 75-85% of requests filled by the pool with no waiting.

Currently, the algorithm I use is something like this:

(PseudocodeSmile | :)
long lDesiredPoolSize = lMinSize;

// NOTE: I multiply by 1.25 to give myself a 25% cushion

// if the last 5 minutes are more active than the hour, use last 5 minutes
if (lRequestsLast5Minutes > (lRequestsLastHour / 12) && lRequestsLast5Minutes > lDesiredPoolSize)
   lDesiredPoolSize = lRequestsLast5Minutes * 1.25;

// if we are getting many pool-exausted scenarios, base off this
if (lPoolExaustedRequests > lDesiredPoolSize)
   lDesiredPoolSize = lPoolExaustedRequests * 1.25;

// if activity last hour >= activity at peak, use peak
if (lRequestsLastHour >= lRequestsAtPeak)
   lDesiredPoolSize = lRequestsLastHour * 1.25;

// make sure we don't exceed the max
if (lDesiredPoolSize > lMaxPoolSize)
   lDesiredPoolSize = lMaxPoolSize;

// if no requests in past hour, empty pool
if (lRequestsLastHour == 0)
   lDesiredPoolSize = 0;


I just made this up and tinkered with it, but I wonder if anyone in CPland has any more experience with this kind of thing?
GeneralCSliderCtrl and textout Pin
ns27-Dec-02 9:01
ns27-Dec-02 9:01 
GeneralRe: CSliderCtrl and textout Pin
PJ Arends27-Dec-02 9:41
professionalPJ Arends27-Dec-02 9:41 
GeneralRe: CSliderCtrl and textout Pin
ns27-Dec-02 9:45
ns27-Dec-02 9:45 
GeneralMDI: Single Doc, Multiple Views Pin
Dean Goodman27-Dec-02 9:00
Dean Goodman27-Dec-02 9:00 
GeneralRe: MDI: Single Doc, Multiple Views Pin
Chris Losinger27-Dec-02 10:25
professionalChris Losinger27-Dec-02 10:25 
GeneralCIPAddressCtrl example Pin
ns27-Dec-02 8:18
ns27-Dec-02 8:18 
GeneralActivating a window and bringing it to the top Pin
Navin27-Dec-02 7:23
Navin27-Dec-02 7:23 
GeneralRe: Activating a window and bringing it to the top Pin
Navin27-Dec-02 7:28
Navin27-Dec-02 7:28 
GeneralRe: Activating a window and bringing it to the top Pin
Nish Nishant27-Dec-02 7:28
sitebuilderNish Nishant27-Dec-02 7:28 
GeneralRegarding terminology Pin
Nish Nishant27-Dec-02 6:27
sitebuilderNish Nishant27-Dec-02 6:27 
GeneralRe: Regarding terminology Pin
AlexO27-Dec-02 6:47
AlexO27-Dec-02 6:47 
GeneralRe: Regarding terminology Pin
Nish Nishant27-Dec-02 6:55
sitebuilderNish Nishant27-Dec-02 6:55 
GeneralRe: Regarding terminology Pin
Michael Dunn27-Dec-02 6:59
sitebuilderMichael Dunn27-Dec-02 6:59 
GeneralRe: Regarding terminology Pin
Nish Nishant27-Dec-02 7:23
sitebuilderNish Nishant27-Dec-02 7:23 
GeneralPROGRAM ICONS (portability and configurability) Pin
Anonymous27-Dec-02 6:01
Anonymous27-Dec-02 6:01 
Generalmessage map question Pin
ns27-Dec-02 5:22
ns27-Dec-02 5:22 
GeneralRe: message map question Pin
valikac27-Dec-02 6:07
valikac27-Dec-02 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.