Problems with increasing/decreasing cache size when live

Hello,
I have configured multiple environments which I'm compacting sequentially and to achieve this I allocate a bigger cache to the env currently being compacted as follows:
Initialization:
DB_ENV->set_cachesize(gbytes, bytes, 1); // Initial cache size.
DB_ENV->set_cache_max(gbytes, bytes); // Maximum size.
While live, application decreases cache of current env when finished and then increases cache of next env using:
DB_ENV->set_cachesize(gbytes, obytes, 0); // Decrease cache size of current env to initial size
DB_ENV->set_cachesize(gbytes, obytes, 0); // Increase cache size of next env to max size.
When I print statistics about the memory pool using DB_ENV->memp_stat I can see that everyting is going normally:
memp_stat: env1 ncache= 8 cache_size=20973592 // env1 is current env
memp_stat: env2 ncache= 1 cache_size=20973592
and then after changing current env:
memp_stat: env1 ncache= 1 cache_size=20973592
memp_stat: env2 ncache= 8 cache_size=20973592 // env2 is now current env
But the problem is that over time memory is leaked (as if the extra memory of each env was not freed) and I'm totally sure that the problem comes from this code.
I'm running Berkeley DB 4.7.25 on FreeBSD.
Maybe some leak was fixed in newer versions and you could suggest to me a patch? or I don't use the API correctly?
Thanks!
Edited by: 894962 on Jan 23, 2012 6:40 AM

Hi,
Thanks for providing the information.
Unfortunately, I don't remember exact test case I was doing, so I did a new one with 32 env.
I set the following for each env:
- Initial cache=512MB/32
- Max=1GB
Before open, I do:
DBEnvironment->set_cachesize((u_int32_t)0, (u_int32_t)512*1024*1024/32, 1);
DBEnvironment->set_cache_max(1*1024*1024*1024, 0);
DBEnvironment->get_cache_max(&gbytes, &obytes); // gives gbytes=1 and obytes=0
After open, I have the following:
DBEnvironment->get_cache_max(&gbytes, &obytes); // gives gbytes=0 and obytes=9502720
memp_stat: cache_size=18644992 cache_ncache=1
So here, the values returned by memp_stat are normal but get_cache_max is strange. Then after increasing the cache to the strange value returned by get_cache_max (gbytes=0, obytes=9502720), I have the following:
DBEnvironment->get_cache_max(&gbytes, &obytes); // gives gbytes=0 and obytes=9502720
memp_stat: outlinks cache_size=27328512 cache_ncache=54
with cache_size being: ((ui64)sp->st_gbytes * GIGA + sp->st_bytes);.
So cache is actually increased...
I try to reproduce this case by opening 1 env as follows.
//Before open
DbEnv->set_cachesize(); 512MB, 1 cache
DbEnv->set_cache_max; 1GB
//After open
DbEnv->get_cachesize; 512MB, 1cache
DbEnv->get_caceh_max; 1GB
memp_stat: cache:512MB, ncache:1, cache_max:1GB
//Decrease the cache size
DbEnv->set_cachesize(); 9MB(9502720B), 1 cache
DbEnv->get_cachesize; 512MB, 1cache
DbEnv->get_caceh_max; 1GB
memp_stat: cache:512MB, ncache:1, cache_max:1GB
All the result is expected. Since when resizing the cache after DbEnv is open, it is rounded to the nearest multiple of the region size. Region size means the size of each region specified initially. Please refer to BDB doc: [http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html|http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html]. Here region size is 512MB/1cache = 512MB. And I don't think you can resize the cache smaller than 1 region.
Since you are opening 32 env at the same time with 512MB cache and 1GB maximum for each, when the env is open, whether it can allocate as much as that specified for the cache, is dependent on the system. I am guess the number 9502720 got from get_cache_max after opening the env is probably based on the system and app request, the cache size you can get when opening the env.
And for the case listed in the beginning of the post
While live, application decreases cache of current env when finished and then increases cache of next env using:
DB_ENV->set_cachesize(gbytes, obytes, 0); // Decrease cache size of current env to initial size
DB_ENV->set_cachesize(gbytes, obytes, 0); // Increase cache size of next env to max size.
When I print statistics about the memory pool using DB_ENV->memp_stat I can see that everyting is going normally:
memp_stat: env1 ncache= 8 cache_size=20973592 // env1 is current env
memp_stat: env2 ncache= 1 cache_size=20973592
and then after changing current env:
memp_stat: env1 ncache= 1 cache_size=20973592
memp_stat: env2 ncache= 8 cache_size=20973592 // env2 is now current envWhen env1 is finishing soon, what numbers do you set in set_cachesize to decrease the cache, including the number of caches and cache size?
When decreasing the cache, I do:
env->GetDbEnv()->set_cachesize((u_int32_t)0, (u_int32_t)20973592, 0);
I mean, in all cases I simply set cachesize to its original value (obtained after open through get_cachesize) when decreasing and set cachesize to its max value when increasing (obtained though get_cache_max; plus I do something like cacheMaxSize * 0.75 if < 500MB).I can reproduce this case. And I think the result is expected. When using DBEnv->set_cachesize() to resize the cache after env is opened, the ncache para is ignored. Please refer to BDB doc here: [http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html|http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html] . Hence I don't think you can decrease the cache size by setting the number of cache to 0.
Hope it helps.

Similar Messages

  • Cs4 problem with link text changing size when clicked

    designing in cs4, the actual text of my text links become huge for a split second when clicked, and then they go back to normal size.  I don't know what is causing this.  I don't want them to change when clicked.  Any ideas?  thanks in advance.

    John,
    If you need all the CSS code, I will attach it below:
    @charset "utf-8";
    body  {
        text-align: left; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
        color: #000000;
        background-color: #333;
        padding-top: 0;
        padding-right: 0;
        padding-bottom: 0;
        padding-left: 0;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 14pt;
    .twoColFixLtHdr #container {
        width: 950px; /* the auto margins (in conjunction with a width) center the page */
        border: 1px solid #000000;
        text-align: left; /* this overrides the text-align: center on the body element. */
        background-color: #E0D2A3;
        margin-top: 0;
        margin-right: auto;
        margin-bottom: 0;
        margin-left: auto;
        padding-top: 0px;
        height: auto;
    .twoColFixLtHdr #header {
        padding: 0px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
        background-color: #000;
        border: 5px ridge #333;
        margin: 10px;
        background-image: url(../website%20stuff/stepping%20on%20constitution--crop%20text.jpg);
        text-align: left;
    .twoColFixLtHdr #header h1 {
        margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
        padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
        font-size: 18pt;
        color: #FFF;
    .twoColFixLtHdr #sidebar1 {
        float: left; /* since this element is floated, a width must be given */
        width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */
        padding: 10px;
        background-color: #E0D2A3;
        margin-left: 20px;
        text-decoration: none;
        color: #000;
        font-style: normal;
        font-size: 16px;
    .twoColFixLtHdr #mainContent {
        margin-right: 0;
        margin-bottom: 0;
        margin-left: 250px;
        padding-top: 0;
        padding-right: 20px;
        padding-bottom: 0;
        padding-left: 20px;
        text-align: left;
        font-size: 14px;
    .twoColFixLtHdr #footer {
        padding: 0 10px 0 20px;
        text-decoration: none;
        background-color: #E0D2A3;
    .twoColFixLtHdr #footer p {
        margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
        padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
        margin-left: 8px;
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
        clear:both;
        height:auto;
        font-size: 16px;
        line-height: normal;
        text-decoration: none;
        font-style: normal;
        text-align: center;
        color: #00F;
    .mainarea {
        background-color: #FFF;
        border: 5px ridge #333;
        font-size: 14pt;
    .twoColFixLtHdr #container #footer {
        font-size: 14px;
        color: #000;
    .twoColFixLtHdr #container #header table {
        text-align: center;
    .twoColFixLtHdr #container #footer .clearfloat table {
        font-size: 14px;
        font-weight: bold;
        color: #F00;
    .twoColFixLtHdr #container #footer .clearfloat {
    .twoColFixLtHdr #container #header table tr td {
        font-size: 24pt;
        font-style: normal;
        font-variant: normal;
        font-weight: bolder;
        color: #000;
        background-image: url(Images/stepping%20on%20constitution--crop%20text.jpg);
    no link underline {
        text-decoration: none;
    .twoColFixLtHdr #container p {
        font-size: 14px;
        font-style: normal;
        color: #000;
    small text {
        font-size: 10px;
    .twoColFixLtHdr #container #header table {
        font-size: 16pt;
    .twoColFixLtHdr #container #header table {
        font-size: 16pt;
    .twoColFixLtHdr #container #header table tr td h2 {
        font-size: 22pt;
        color: #000;
    .twoColFixLtHdr #container #mainContent .twoColFixLtHdr {
        text-align: left;
        font-size: 14px;
    .twoColFixLtHdr #container #mainContent .twoColFixLtHdr h2 {
        color: #009;
        font-style: normal;
        text-align: left;
    .twoColFixLtHdr #container #mainContent .mainarea table tr td strong {
        font-style: normal;
    .twoColFixLtHdr #container #mainContent .mainarea table tr td p {
        font-style: normal;
        font-weight: normal;
    .twoColFixLtHdr #container #sidebar1 {
        color: #00F;
    .twoColFixLtHdr #container #mainContent .twoColFixLtHdr h2 em {
        text-align: center;
    .italics {
        font-style: italic;
    .italics {
    .font-color {
        color: #003;
    .italics {
        font-style: italic;
    .twoColFixLtHdr #container #mainContent .mainarea table tr .twoColFixLtHdr .blue a {
        color: #009;
    .twoColFixLtHdr #container #mainContent .mainarea table tr td .link-font-color {
        color: #00C;
    .align-center {
        text-align: center;
    .twoColFixLtHdr #container #mainContent .mainarea table tr .align-center {
        text-align: center;
    .center-align {
        text-align: center;
    Thanks,
    Craig

  • Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    As you are asking about it, looks like you do see a problem. So if googling does not provide a solution, you should describe the issue in detail so we can try to help out.

  • Why can't I increase the cache size in FF 4?

    OK, first of all, to be honest I really don't like FF 4. I see absolutely no advantages over the previous versions and I can't find anything to like about FF 4..
    One big and annoying factor (besides the how UI and layout) is why can't I increase the cache size?
    If I choose to manage it myself and override what the developers did, I can go to 1024 and that's it. If I want 5GB of cache, I'm out of luck because some coded decides how I want to manage my disk space? They're kidding, right?
    What the heck is the matter with these guys?
    This thing is so bad that I've resisted upgrading, I didn't have a choice when I upgraded to Ubuntu 11.04, it came with the package.. Yuk... I've been a FF user since late 2003 or early 2004... I'm about to part ways with this thing if they don't fix it...Even IE sucks less than this thing....
    None of my Windows machines are going to get 4 loaded if I can help it.. About 1 million people agree with me...

    correction.. It's not a million.. it's legion at this point..
    Google "I hate FF 4" and you'll get 40,900,000 results... I don't trust Google further than I can throw them, but 41 million people complaining about this thing? What a freakin travesty...

  • How can I increase the thumbnail size when using Safari to upload an image to a website?

    I upload many images to multiple websites and when using Safari to upload these images, the thumbnails are so small I can barely make out what the image is. I can easily figure out how to increase the thumbnail size when viewing them in Finder and set the default to my liking, but I cannot seem to find a way to do this in Safari. The last topic I saw on this was form 2013 and have not seen any update. Is there a way to do this?

    Delete all unused, invisible layers.
    Sometimes zip compression is better than jpg compression (in the pdf output settings). Zip is lossless, and works better with non gradient colour or no images.
    Flattening the image before you save it to pdf can reduce the file size if you are using jpg compression.
    Post a preview of your pdf and we can comment further on how to reduce the file size.

  • I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    Can you open the Preview program without loading a file, like by itself?
    If it doesn't load then I suspect a corrupt Preview preference file.
    Deleting the System Preference or other .plist file
    Can you open other files with Preview, like jpg's and images?
    How about other PDFs? or is it just that one you have downloaded?
    Run through this list of fixes
    Step by Step to fix your Mac

  • Having big problems with my new Mac Pro, when I launch Photoshop CC, I get an error message, can carry on but after a few tasks it starts going gar... menus go blank, when you try to save it shows a blank box.... can anybody help?

    Having big problems with my new Mac Pro, when I launch Photoshop CC, I get an error message, can carry on but after a few tasks it starts going gar... menus go blank, when you try to save it shows a blank box.... can anybody help?

    when I launch Photoshop CC, I get an error message
    and what exactly is the text of that error message?

  • Problem with this new version is when i open firefox something change my home page to mozila defalut page and in the new tab open mozila firefox first run page.Sorry for my bad English

    Problem with this new version is when i open firefox something change my home page to mozila defalut page and in the new tab open mozila firefox first run page.Sorry for my bad English

    Sounds like this issue:
    * http://kb.mozillazine.org/Preferences_not_saved
    * [[Preferences are not saved]]

  • Why  would an error pop up saying the installer is damaged. The Installer can't open the package. There may be a problem with file ownership or permissions. when trying to install java 7?

    why  would an error pop up saying the installer is damaged. The Installer can’t open the package. There may be a problem with file ownership or permissions. when trying to install java 7?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Select
    /var/log ▹ install.log
    from the hierarchical list on the left. If you don't see that list, select
    View ▹ Show Log List
    from the menu bar. Then select the messages from the last installation or update attempt, starting from the time when you initiated it. If you're not sure when that was, click the Clear Display button in the toolbar of the Console window and then try the installation again.
    Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Problems with email account on ipad2 when changing from mobileme to icloud

    Problems with email account on ipad2 when changing from mobileme to icloud

    Would you please give us some more information about your problems.

  • Is it possible? "automatically increasing text block size when typing?"

    I want to know that:  "automatically increasing text block size when typing?" This works exactly in Freehand 10, 11.
    is it possible?
    Thanks.

    Smart Text Reflow was added to CS4, which might also be of interest to you.
    Adobe does, in fact listen to customer requests for new and improved features. Not all requests can be satisfied during each release cycle, but if you have a suggestion, you should file it at Adobe - Feature Request/Bug Report Form

  • I'm having problems with restoring my iphone 4. when i try to restore

    i'm having problems with restoring my iphone 4. when i try to restore

    unfortunately there are tons of people with this issue but Apple has not given any answers for us to fix this issue yet. I wish they would allocate more people to solving these problems when they roll out new versions of itunes along with new hardware.

  • Has anybody had a problem with the mouse cursor lagging when navigating the drop down menus? this only started happening after a re-install. it only occurs in Photoshop elements 13 in the  photo editing section,and no other application. My mouse drivers a

    Has anybody had a problem with the mouse cursor lagging when navigating the drop down menus? this only started happening after a re-install. it only occurs in Photoshop elements 13 in the  photo editing section,and no other application. My mouse drivers are up to date.Any help or advice would be most welcome.

    Good day!
    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements
    and please read this (in particular the section titled "Supply pertinent information for quicker answers"):
    http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html
    Regards,
    Pfaffenbichler

  • I am having problem with my itunes account because when i try to buy something online it say..Your purchase can not be completed for assistance, contact itunes support.

    I am having problem with my itunes account because when i try to buy something online it say..Your purchase can not be completed for assistance, contact itunes support.

    What happened when you contacted iTunes support as directed?
    http://www.apple.com/support/itunes/contact/

  • HT4436 i have a problem with my Macbook Pro. When i tried to open it, something appeared : "enter your system lock PIN code to unlock this Mac". What should i do?

    i have a problem with my Macbook Pro. When i tried to open it, something appeared : "enter your system lock PIN code to unlock this Mac". What should i do?

    Question is did you lock your Mac from Find my iPhone using iCloud or is the Macbook really yours?
    If you have in fact locked your Mac using Find my iPhone on iCloud then you will need to enter the PIN you have set when you locked the Mac.
    *If you have not iniate the remote Lock then someone else has used your Apple ID and Password to lock your mac.
    Message was edited by: Ammadz

Maybe you are looking for

  • How To Use Your Own Router with Out Loosing Verizon's FIOS Services

    How to use your own router with Verizon’s FIOS Service First, you need a basic understanding of how FIOS works but unfortunately there are two types of FIOS systems out there. All of the systems utilize a fiber optic cable to bring TV, phone and inte

  • Want to save file as a name of controls(Boolean Tick)

    Hello all,  I have many option on front panel like 1. Panel_One 2. Panel_Two 3.Panel_Three As user will select outof this that name should be given to file name. But its boolean so how to transfer the label of Boolean Tick as file name? It should als

  • Why do calls keep dropping?

    My calls have started routinely dropping during the conversation.  The phone rings okay but calls just keep dropping. 

  • Back up and sync a large iTunes collection

    My main computer is an iMac. I have an iTunes collection with 89,000 songs in it on that machine. I have baked the media up to an external drive along with the iTunes Music Library document. What I would like to do first is be able to plug my externa

  • Why do I get the error "The target GatherAllFilesToPublish does not exist"?

    I have recently installed the new Azure development tools for Visual Studio 2010 service pack 1. Every time that I try to publish an existing website (using file system deployment) I get the following error: The target "GatherAllFilesToPublish" does