```json
{
    "title": "GrabPERF: New Agent Code in Testing",
    "url": "https://performancezen.com/2006/07/21/grabperf-new-agent-code-in-testing/",
    "datePublished": "2006-07-21",
    "dateModified": "2006-07-21",
    "language": "en-US",
    "description": "After a few month hiatus, I am starting to code for GrabPERF again. I need to exercise my brain; as I am a hobbyist code mangler, I have to take…",
    "author": "spierzchala",
    "publisher": "Performance Zen"
}
```

# GrabPERF: New Agent Code in Testing

After a few month hiatus, I am starting to code for [GrabPERF](http://www.grabperf.org/) again. I need to exercise my brain; as I am a hobbyist code mangler, I have to take on a project every now and then to keep my not-so-l33t skillz honed.

The change to the agent is one of efficiency. The current production agent opens two database connections to run tests: one to retrieve the test configuration data; the other to insert the results of the tests. This means I loop through one set of database query results while doing inserts inside the loop on a second database connection.

This is stupid.

The new code opens a single connection to the database, retrieves the test configuration, dumps the results to an array of arrays, then inserts the data on the same connection. This is more efficient, as I use persistent connections and compression to MySQL to improve performance.

I have this running as **TEST AGENT 1** from the Technorati #2 site.

Let me know if you see any madness...outside of Washington DC, and specifically with GrabPERF.

Technorati Tags: [GrabPERF](http://technorati.com/tag/GrabPERF), [PERL](http://technorati.com/tag/PERL), [MySQL](http://technorati.com/tag/MySQL)
