|
Replies:
14
-
Pages:
1
-
Last Post:
Jan 3, 2008 12:33 PM
Last Post By: Ready to boil
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 21, 2007 6:20 PM
|
|
|
|
Oracle 10g, locally managed tablespaces (data & index), auto segment space management.
Number of extents on the object & indexes is decent, around 200-300.
Object size is not extra large either, about 2GB for data, and around 1GB for each index.
First 90% of inserts (regular logging inserts) everything runs really well, and then suddenly it becomes almost 20-30 times slower, and drags like this for the remainder of the load.
I checked out the sessions, all they do is reading the index datafile.
I have at least 2 objects with such behaviour, and this repeats on every instance. I used BIGFILE and SMALLFILE tablespaces, process acting the same.
What could be the cause of this? I would rather address the cause, then create a separate exception handling for each of such objects.
|
|
|
Posts:
4,030
Registered:
05/30/00
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 21, 2007 7:25 PM
in response to: Ready to boil
|
|
|
|
And the inserts are being performed as?
- insert as select
- bulk insert
- implicit cursor loop
- explicit cursor loop
- individual insert statements
These are in descending order of performance, so I would guess it is the last one.
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 21, 2007 7:27 PM
in response to: Pointless
|
|
|
|
Yes, the last one. I'm using bind variable loop for a prepared statement.
Data is coming from generic external sources, which may be a file or another database.
|
|
|
Posts:
648
Registered:
10/05/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 21, 2007 8:48 PM
in response to: Ready to boil
|
|
|
Assuming that you're using JDBC API to access Oracle,
you might need to cross check both of your Java app and Oracle.
1. Extended sql trace on Oracle session. (or AWR report ?)
2. Garbage collection dump and/or thread dump on JDBC session.
(Or do you use profiling tool for java app?)
There can be too many reasons..Don't you think so?
You need to post what you've actually seen using above tools..
========================================
Dion Cho
Blog: http://ukjax.blogspot.com
Wiki: http://wiki.ex-em.com
========================================
|
|
|
Posts:
148
Registered:
02/19/02
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 22, 2007 7:01 AM
in response to: Dion_Cho
|
|
|
|
try to increase the size
of the undo tablespace,
these inserts generate lot of undo data ,
or try to commit in interval of every 1000 inserts or so.
|
|
|
Posts:
648
Registered:
10/05/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 22, 2007 7:28 AM
in response to: Aris_DC
|
|
|
|
Good guidance, but too general.
All we need is "what is actually happening"? Don't you agree?
If the undo space is the problem, the AWR report would show HW contention on undo segment or some other undo-related statistics.
If the commit frequency is the problem, the AWR report would show long log file sync wait or log file parallel write wait.
Wouldn't the AWR snapshots of "good status" and "bad status" tell something meaningful?
If the java garbage collection is the problem, the garbage collection dump would show a quite frequent and annoying garbage collection.
The java app has so many various performance pitfalls just like Oracle does.
As i told, there can be "too" many reasons to list here.
All we need is the fact that what is really happening here.
|
|
|
Posts:
424
Registered:
12/21/99
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 22, 2007 9:52 AM
in response to: Dion_Cho
|
|
|
|
What I would do is trace using dbms_monitor.
Use dbms_application_info to set module and action OR (Just ignore if you can easily identify the session when no connection pooing/shared server issue etc..)
Change the ACTION just after insert so you catch events only for inserts if that is ONLY the thing you concerned.
Use dbms_monitor to enable/disable the trace (with waits=> TRUE) when you feel inserts are going too slow.
Just TKPROF to see what is the real wait event is ?
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Dec 24, 2007 7:43 PM
in response to: Aris_DC
|
|
|
|
Just to make this one clear - I commit every 10K records, and I have enough of UNDO, which never gets full.
Everything runs fine, very fast, until it hits these last 10% of data, and starts reading the index tablespace like crazy.
It could be the garbage collection too, I force it right after commit, but you never know if anything is leaking. I'll have to look into this as well.
And it doesn't explain peaking I/O either.
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 3:00 PM
in response to: Ready to boil
|
|
|
|
Changed the design to drop indexes, run inserts, recreate indexes.
All inserts were done twice as fast (compared to the speed before it was becoming stagnant), and index regeneration took at little as 5 minutes for all indexes.
So I guess, it wasn't Java garbage collection after all.
|
|
|
Posts:
147
Registered:
09/14/05
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 3:03 PM
in response to: Ready to boil
|
|
|
|
Glad to hear it...but did you ever by chance use v$session_wait.event or tkprof to find the exact wait event that was causing your issue? Inquiring minds want to know!
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 3:26 PM
in response to: Steve Karam
|
|
|
|
v$session_wait was showing async reads of index tablespace (never showed writes) during the slow portion of the process.
Because of NY and bad timing (needed delivery one way or another), had not time to run tkprof.
|
|
|
Posts:
648
Registered:
10/05/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 4:12 PM
in response to: Ready to boil
|
|
|
|
> v$session_wait was showing async reads of index tablespace (never showed writes)
Can you tell me the exact wait event name and the parameters(p1,p2,p3) of that event?
Event name and its parameters are very important.
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 4:50 PM
in response to: Dion_Cho
|
|
|
|
event=db file sequential read
p1=file# = index bigfile tablespace data file
p2=block# (changing all the time)
p3=blocks = 1
Wait_class = User I/O
State = waiting
Seconds_in_wait = always="0"
|
|
|
Posts:
648
Registered:
10/05/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 2, 2008 10:08 PM
in response to: Ready to boil
|
|
|
|
Oh, yes. The the reason of performance degradation is very simple.
Insertion on table with indexes need index management.
At early stage, the buffer cache space owned by indexes are not so big that many of the indexe blocks are located in the buffer cache and your insertion operation might end up with memory operation.
But as index grows fast, your buffer cache has no room for index blocks.
DBWR flushs out dirty buffers and you should reload target index block from disk.
This involves large amount of disk I/O, hence performace degrades.
You said you have a couple of indexes, so these indexes compete to occupy the buffer cache. This makes things worse.
This is a natural pheonemon caused by online index management.
For large insertion, direct path load and/or offline index management might be the only solution.
PS) Conventional write operation is always done by DBWR process.
It's the reason why you can't see the write wait event from v$session_wait view.
Typo...
Message was edited by:
Dion_Cho
|
|
|
Posts:
58
Registered:
10/25/07
|
|
|
|
Re: Long insert becomes lethargic after quickly processing 90% of the data
Posted:
Jan 3, 2008 12:33 PM
in response to: Dion_Cho
|
|
|
|
It makes so much sense now. We've been blaming everything from bad disk clusters, application, ...
We'll probably have to start partitioning these tables anyway.
Thank you Mr.Cho for the explanation.
|
|
|
|
Legend
|
|
Guru : 2500
- 1000000
pts
|
|
Expert : 1000
- 2499
pts
|
|
Pro : 500
- 999
pts
|
|
Journeyman : 200
- 499
pts
|
|
Newbie : 0
- 199
pts
|
|
Oracle ACE Director
|
|
Oracle ACE Member
|
|
Oracle Employee ACE
|
|
Helpful Answer
(5 pts)
|
|
Correct Answer
(10 pts)
|
|