I have an application which read a database and write files. Current I have at least 64.000 records in the table.
I decided to use a queue to process this records and write the file. The problem is that the process have been using just 50% of my CPU and this process is very slow. Sometimes I get a "Connection closed" from hibernate.
Basically, the process in MDB executes queries and do updates, and after, write the file.
What I should do to start a tunning in this process, in order to process faster ? increase MDB threads ?
Robert Siqueira wrote: the process have been using just 50% of my CPU and this process is very slow.
What this usually means is that your process has one CPU (or core) locked up on a 2-CPU machine. Check whatever process monitor your OS has. It may be possible to create multiple threads for processing to spread the CPU load around. You'll have to figure out how to get them to collaborate writing a single file, of course.
You'll want to check and see if you have free memory too, as running out of memory will cause the OS to start swapping memory to disk which makes more work for the CPU.
Do you have the database on the same machine? That's a bad idea as your app and the database will be competing for the same resources.