# the way to calculate the cache size



## tem_dl (Sep 1, 2009)

Hi All, 
                Iâ€™m tuning my LDAP DB (BDB type).
                Iâ€™m reading at http://www.openldap.org/doc/admin24/tuning.html#Berkeley DB Cache 




> ```
> #(Number of hash buckets + number of overflow pages + number of duplicate pages) * page size / 2
> #The objectClass index for my example database is 5.9MB and uses 3 hash buckets and 656 duplicate pages. So:
> #              ( 3 + 656 ) * 4KB / 2 =~ 1.3MB.
> ...



I understand that: with each index ( in this case only objectclass is indexed), we must calculate their cache size individually and sum every them. (1)
-    I can specify â€œNumber of hash bucketsâ€ & â€œCache Size â€œ (2)by command

```
#db_stat-4.4 -m | head -n 25
32771    Number of hash buckets used for page location
Pool file: <index>.bdb
<number>           page size
```

-	I can specify â€œNumber of overflow pagesâ€ & â€œNumber of duplicate pagesâ€ by command

```
#db_stat-4.4 -d *.bdb (3)
0              Number of tree duplicate page
0              Number of tree overflow pages
```

(1)	Did I understand right? 
(2)	Which page size will we use, some of index file use 4K page size, others use 16K page size? 
(3)	Do must I run for each index or *.bdb is still ok?

Could anyone help me? This chapter is not clearly huh?

Thank for reading


----------

