Hi all,
I've written a relatively complex program that makes use of the excellent
ARS module to query a
remedy server for ALL tickets modified on the previous day. Once it has the entry numbers for the tickets, it runs another query for each ticket to get to the actual data in the tickets. This is relatively easily accomplished using the above module. The problem comes in the way that the data is stored.
Basically each entry is returned as a hash of many different fields from the schema. Some of these fields are simple single string fields, others are returned as an array reference, and yet others are returned as a hash reference. Some of the fields that are returned as a list are often a list of hash references. Again, it's relatively easy to run through this and grab the data that I need. The problem that I am running into relates to the amount of memory that this chews up.
A typical day will have around 9000 records. Some of the fields will contain about 3k of data, I would guess that the total record for each entry runs about 5k on average. I'm using about 2k of the 5k per entry. However, the script is using at times up to 200 meg of memory. The server admins have come back and said that this is too much memory being used, and they need to find some other solution. At this point, I turn to you my brethren and ask for assistance. How can I get this down, preferably maintaining a balance between CPU (which is currently very low) and memory usage (which is currently very high).
The only thing that I can think of right off the top of my head is to spawn a new process for each ticket that I want to get the data from and run the query for the ticket data in that process, but I think that this is going to have some severe performance issues, a better balance is desired. If you would like to see the code, please let me know.