473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How does a bufferpool run out of pages.

Everything I read on DB2 indicates that the bufferpool is a pool of
database pages used to speed up database access. It is controlled by
us, when we specify how many pages we would like to have allocated.

My question is:
1. Under what circumstances can the buffer pool run out?
Its my understanding that we would go into synchronous read/write mode
if all pages were dirty and we needed to read in a new page. In this
case, why would it fail.

The error I get is:
[IBM][CLI Driver][DB2/NT] SQL1218N There are no pages currently
available in bufferpool "4096". SQLSTATE=57011

The help documentation does not tell me what the "4096" bufferpool is.

NOTE: I have 2 databases defined in 1 instance. When 1 user only runs
applications, there is no problem. If another user uses the other
database, then we usually get this problem.

The documentation also makes note of the parameter: AVG_APPLS
-it implies that the optimizer uses this parameter to determine how
much of the buffer pool to use. What does this really mean. If the
optimizer thinks it can use 80% of the buffer pool and then it can't
get it, then it may fail? Is this possible?

Thanks for any suggestions.

Aug 9 '06 #1
9 21954
<ac******@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Everything I read on DB2 indicates that the bufferpool is a pool of
database pages used to speed up database access. It is controlled by
us, when we specify how many pages we would like to have allocated.

My question is:
1. Under what circumstances can the buffer pool run out?
Its my understanding that we would go into synchronous read/write mode
if all pages were dirty and we needed to read in a new page. In this
case, why would it fail.

The error I get is:
[IBM][CLI Driver][DB2/NT] SQL1218N There are no pages currently
available in bufferpool "4096". SQLSTATE=57011

The help documentation does not tell me what the "4096" bufferpool is.

NOTE: I have 2 databases defined in 1 instance. When 1 user only runs
applications, there is no problem. If another user uses the other
database, then we usually get this problem.

The documentation also makes note of the parameter: AVG_APPLS
-it implies that the optimizer uses this parameter to determine how
much of the buffer pool to use. What does this really mean. If the
optimizer thinks it can use 80% of the buffer pool and then it can't
get it, then it may fail? Is this possible?

Thanks for any suggestions.
Issue the following SQL statement on each of your two databases and post the
results here:

db2 select * from syscat.bufferpools

Most likely you just need to increase the size from the default, which is
ridiculously low.

Also, please indicate the amount of real memory installed on the database
server.
Aug 9 '06 #2
My question is:
1. Under what circumstances can the buffer pool run out?
You'll get a -1218 when all the pages in the bufferpool are in use and
cannot be evicted in order to bring in a new page.

By 'in use', I mean being actively locked in memory by a query.
The help documentation does not tell me what the "4096" bufferpool is.
Bufferpool 4096 is one of the so-called 'hidden' bufferpools that are
always created on db startup. Its only 16 pages big, so its not all
that surprising that you'd start getting BP full errors.
NOTE: I have 2 databases defined in 1 instance. When 1 user only runs
applications, there is no problem. If another user uses the other
database, then we usually get this problem.
What it sounds like is happening is that db #1 is sucking up all the
memory available on the machine. When a user connects to db #2, DB2 is
unable to allocate memory for the bufferpools in db #2, instead
assigning each tablespace to use the hidden bp's.

Which then leads to BP full messages.
The documentation also makes note of the parameter: AVG_APPLS
-it implies that the optimizer uses this parameter to determine how
much of the buffer pool to use. What does this really mean. If the
optimizer thinks it can use 80% of the buffer pool and then it can't
get it, then it may fail? Is this possible?
I'm not quite certain on how the optimizer models bufferpool usage - I
believe (but am liable to be wrong :) that its mostly used to try to
figure out whether to introduce temp spills into the plan - ie if it
knows that it needs X pages, but the BP is only Y pages big, then some
temps will be introduced.

In any case, DB2 will mediate bp usage between applications, swapping
pages in and out of memory as required. The only time the query will
fail (modulo other resource issues) is, as I mentioned, if every single
page in the BP is being actively used by another query, and cannot be
evicted.

jsoh

Aug 10 '06 #3
Excellent comments. Thanks for looking into this... But I have
additional information that my help further refine our problem.

Buffer pool is supposed to be a memory backing for a page system. Its
purpose is to speed up retrieval of data. Thus how can you lock a
buffer pool. It should spill to disk. Yes, it will be very slow, but
it does make sense. Locking a page is interesting. Why would this be
required, especially, since buffer pools are defined per database, and
in our case I have 1 user in db-1 and 1 user in db-2.
(These are just discussion points.. I believe you are absolutley
correct about the reason, its just not clear as to why this would
happen.)

Your comment:
In any case, DB2 will mediate bp usage between applications, swapping
pages in and out of memory as required. The only time the query will
fail (modulo other resource issues) is, as I mentioned, if every single
page in the BP is being actively used by another query, and cannot be
evicted.
Interesting since there is only 1 active user in this db. Thus there
is no other query.
I started a command window and tried to manually connect to db-2 while
a user was successful into db-1. The error I get was:
SQL1478W The defined bufferpools could not be started.... Exactly
like you implied.
Now we to further diagnose why I could not get the space. Details
follow.

System memory: 3.25 gb
Instance memory: 6600 x 4k = 27,033,600 (round to 27 meg)
Db-2 memory (from configure parms) = 449,196 * 4k = 1,839,906,816 = 1.8
G (rounded)(AUTOMATIC allocation)
db-1 memory exactly like db-2 above 1.8 G (AUTOMATIC allocation)

We see that 1.8+1.8 = 3.6 Gig which is more than my physical memory,
but DB2 is setup for AUTOMATIC database_memory allocation, thus I would
assume it would reassing the value.
Ideally, this is what we would like. If there is 1 database, then
grab as much as possible for this 1 db, but, if we need to
start/activate another db, then I thought this automatic would
negotiate between the 2 for a middle of the road value between the 2.
Additionally, no where does it say, you need the physical memory to
back up this number. (like it explicitly states for bufferpool
allocations).

I check the bufferpools for both databases.
Db-1 wants: 270,295 * 4k = 1,107,128,320 (or 1.1 gig rounded)
db-2 exatcly the same.
thus 2 bufferpools of 1.1+1.1 = 2.2 gig required.
- now the docs says this memory must be available or it will default to
the smaller internal bufferpoosl.

I have 3.25Gig on this machine thus this should be potentially
available and is, when I checked task manager:
Task manager reports:
(with db-1 and db-2 both active, but db-2 cripled)
Total memory: 3.2
available : 1.9 (db-2 wanted 1.1 gig only... why could it not get
it... all system overhead is already built in to this, since db-2 is
started with the small buffer pool)
And the db2syscs.exe using: 1,192,502 K. (not the assumed 1.8 G
(rounded) values we would expect from the database_memory setting).

So with 1 full functional db-1 connection we only used 1.2 Gig and the
system still says there is 1.9Gig available.
Thus why did the second db connection fail to get the bufferpool for
the db.
I can fix the problem by forcing a smaller database_memory value (ie,
removing the automatic and specifying a smaller value), but this limits
the memory used when only 1 db is active.
Any suggestions. (it couild be the numbers are just too close to the
pysical limits of the machine, even though the math indicates I should
have room).
Thanks for all your comments.

Aug 10 '06 #4
What OS are you using, because if it is Windows 32bit there could be
issues there.

Aug 10 '06 #5
"p175" <td******@hotmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
What OS are you using, because if it is Windows 32bit there could be
issues there.
On a 32-bit instance, there are limits on database memory that range from
about 1.1GB to 2GB, depending on the OS.
Aug 10 '06 #6
ac******@gmail.com wrote:
Excellent comments. Thanks for looking into this... But I have
additional information that my help further refine our problem.

Buffer pool is supposed to be a memory backing for a page system. Its
purpose is to speed up retrieval of data. Thus how can you lock a
buffer pool.
The buffer pool is not locked but rather the pages in the buffer pool.
It should spill to disk. Yes, it will be very slow, but
it does make sense. Locking a page is interesting. Why would this be
required, especially, since buffer pools are defined per database, and
in our case I have 1 user in db-1 and 1 user in db-2.
A page _must_ be pinned in memory while DB2 reads data from the page or
writes data to it. Otherwise, the page could be evicted while the
read/write occurs and your whole system would become corrupt. Now it
depends on the amount of work that has to be done on a page and also what
other related (or unrelated) work is going on at the same time.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Aug 10 '06 #7
Buffer pool is supposed to be a memory backing for a page system. Its
purpose is to speed up retrieval of data.
That is correct.
Thus how can you lock a
buffer pool. It should spill to disk.
Err. I'm not quite sure what you're referring to by 'locking a buffer
pool'.
Locking a page is interesting. Why would this be
required,
For example, when an change is made to a page, it needs to be locked so
that other applications cant simultaneously make changes, possibly
overwriting changes that had been made.

'Locking' is technically an incorrect term, as it implies that the
normal db locks are used - they're not. Its a more lightweight, finer
granularity mechanism.
especially, since buffer pools are defined per database, and
in our case I have 1 user in db-1 and 1 user in db-2.
A bufferpool in db-1 has nothing to do with a bufferpool in db-2.
Except if the memory allocated in db-1 results in insufficient memory
being available when db-2 starts up to bring up those bufferpools.
Your comment:
In any case, DB2 will mediate bp usage between applications, swapping
pages in and out of memory as required. The only time the query will
fail (modulo other resource issues) is, as I mentioned, if every single
page in the BP is being actively used by another query, and cannot be
evicted.
Interesting since there is only 1 active user in this db. Thus there
is no other query.
Yes. But its a 16 page bufferpool. Thats insanely small. Its trivial to
craft a query that'll need that many pages simultaneously.
I check the bufferpools for both databases.
Db-1 wants: 270,295 * 4k = 1,107,128,320 (or 1.1 gig rounded)
This calculation is incorrect. There is overhead associated with a
bufferpool (ie, size of descriptors, other metadata) which is not
reflected in the actual page count. I dont have the fudge factor handy
at the moment - but I dont believe that it would account for more than
a 10% increase.

jsoh

Aug 10 '06 #8
Can anyone tell me why they think there is a limit on database memory?
- Yes I am using Windows Server 2003
- Where did you read this? Is it in the IBM docs or external.
I read that domain controllers have a limit on their internal database
maximums(ie. used by the domain controller), but this does not apply to
user applications such as db2 or SQL server.
What OS are you using, because if it is Windows 32bit there could be
issues there.
>On a 32-bit instance, there are limits on database memory that range from
about 1.1GB to 2GB, depending on the OS.
Otherwise, I guess there is no definite answer on how automatic memory
allocation for the database_memory setting really works and why it
could not obtain the memory I requested.

Aug 11 '06 #9
AncrewC wrote:
>>On a 32-bit instance, there are limits on database memory that range from
about 1.1GB to 2GB, depending on the OS.

Otherwise, I guess there is no definite answer on how automatic memory
allocation for the database_memory setting really works and why it
could not obtain the memory I requested.
These limits are either imposed by the operating system or by DB2 itself.
Usually, it is the operating system that does not allow DB2 to allocate
more than a certain amount of memory. And automatic memory management can
only operate with those limits.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Aug 11 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Li Kao | last post by:
After incrementally increasing SORTHEAP (and the commensurate increase in SHEAPTHRES) and *slightly* reducing the bufferpool size, I find that my query is no longer taking advantage of async IO for...
5
by: Paul Shaw | last post by:
Can anyone explain why an insert might cause multiple logical bufferpool data reads? Here's a situation that has me scratching my head. Table A's data resides in tablespace B Table A's...
1
by: Christian Berg | last post by:
Hi, I have got a problem with resizing the bufferpool of a DB2 v.8.2 instance. The DB2 runs on an AIX 5.x platform. Problem is that an "ALTER BUFFERPOOL ..." command is not persistent if...
5
by: Hemant Shah | last post by:
Folks, I am not sure what I am doing wrong, but We have an transaction that does some serious calculation on small chink of data over and over again. It selects few rows from the table...
20
by: Hemant Shah | last post by:
Folks, I am using DB2 UDB 8.2 on AIX 5.1. How large of a bufferpool can you create? I tried to create a 4GB bufferpool db2 complained that is cannot allocate enogth memory. I have 16GB on this...
3
by: dotyet | last post by:
Hi Everyone, I am in a very strange situation, and am looking for suggestions to tackle it. I have a 10 gig database on 64-bit windows 2003 running platform. The database has about 5 gigs of...
3
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! Is it possible to alter tablespace so that you don't connect to the database? The problem I have is this. I got a DB backup from a machine with 16 Gb of RAM. There was a bufferpool set to...
3
by: Mark A | last post by:
<dcruncher4@aim.comwrote in message news:fuevgh02ug6@drn.newsguy.com... I would try these: db2set DB2_USE_ALTERNATE_PAGE_CLEANING=ON (this will override CHNGPGS_THRESH) db2set...
3
by: dunleav1 | last post by:
In 9.1 and 9.5 (Linux 64 bit) when a buffer pool is set to self- tuning, how are blocks configured in respect to blocked vs non-blocked when self-tuning is set to on? (ie) I have one bufferpool...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.