in reply to DBI Performance help
Although your program seems quite simple, it is not obvious where the performance bottleneck is and there are many possibilities within your program, the modules you use and the databases you are accessing. A good place to start might be to profile the execution of your program and then focus your attention on whatever takes the most time.
I have found Devel::NYTProf to be easy to use and very informative.
I would first try to determine whether most of the time is spent executing your program or waiting for the databases to respond. As your program is quite simple, I suspect the latter.
You may find that only the selects or only the inserts are slow. Without knowing anything about your databases or systems, it is hard to say anything other than: there are many possibilities. The underlying network or servers may be overloaded. You may have triggers on your database that are consuming time and resources. You may be querying a poorly optimized view.
Rather than trying to identify all the possibilities in advance, simply start to track down what is taking the time and follow the leads.
Eventually, you will identify something that is consuming a lot of time. You should be able to identify what is taking the most time quite quickly.
The next operation step is to try some alternative approach in hope that it will be faster. think about why that operation is slow and what changes you could make that might be make it faster. Then try some of your ideas.
You are already using Benchmark. Keep good records as you progress so you know what changes you made and what impact they had on performance.
Be prepared to back out changes. Not everything you try will be an improvement.
It is not obvious what your underlying databases are. They may have tools that will help you understand why the queries you are running take so long to execute. If they do, you could use them or get help from someone who is familiar with them.
If you find you are not making good progress, get help from others, providing the information you have gathered and the alternatives you have tried.
|
|---|