-2

I have a program(EOD batch) which processes the daily accrued up accounting positions and updates the UPDT table.

The program is such that.

  1. Query fetches the results from various tables as a result of join etc and stores the records in tempfile.txt
  2. Records are read one by one from tempfile.txt and some series of calculations happen.
  3. For each record which is read; after the calculations are complete for that record, we call update_UPDT() method which commits the calculated values to UPDT table in database.

NOTE: I want to improve the performance of the program.
Please suggest a better approach. I have several plans in mind.

  1. Use Xml instead of tempfile. Xml would be lighter.
  2. Instead of writing each record to DB one by one, write to some temp table or say xml and then do bulk posting to DB once entire set of calculations are happnened for all records.

Any other suggestions ?
Or using arrays would be better?

TridenT
  • 4,879
  • 1
  • 32
  • 56
user3346282
  • 53
  • 1
  • 2
  • 10

1 Answers1

0

First things first: measure.

You need to have a very good idea of what's slowing things down before you start thinking about solutions.

  • Attach a profiler like VisualVM to your process and try to figure out the hot spots.
  • Print GC details of your application to get a better understanding of memory allocation/cleanup.
  • Measure underlying system performance: CPU utilisation, disk I/O and network traffic.

Once you've got all that information, you should be able to identify the areas you need to improve. Then, and only then, is it time to think of what to change.

That's the only reliable approach to optimisation.

Community
  • 1
  • 1
biziclop
  • 48,926
  • 12
  • 77
  • 104
  • @Thanks Bizclop. Will measure the hotspots first to locate the places of improvement. – user3346282 Apr 21 '15 at 05:14
  • I measured the performance and it seems that updateUPDT() method is hit nearly 12000 times. So each of 12000 records is updated one by one which seems to be a bottleneck. Now instead of writing all the records one by one, i am writing them to a "BULKXML". Once all records are inserted into bulk xml, i have to update the same into UPDT table which i want to achieve through stored procedure. Pls help me for the stored proc. Do I need to write the update statement in storedproc or should i use join in the stored proc to update the table values from the xml values.???? – user3346282 Apr 22 '15 at 12:28