If you have large volumes of data to insert or update, you should wherever possible perform those operations in batched transactions. It is more expensive to start a new transaction for every change than it is to attempt to make many changes in a single database transaction. For example, a request handler might log every single hit to a log table. Suppose that it takes 50 milliseconds to write a row in a log table. If that is the case, then the request handler cannot serve requests any faster than 20 per second, even if the rest of the request handling mechanism is blazingly fast. But writing an entry in a log table is not a critical part of the request handling operation, and thus should not be such a limiting factor.

The solution to this problem is to introduce a queue between the request handler and the database facility. When the request handler wants to make a database entry, it places the log entry on the queue, then continues handling the rest of the request. A separate component reads sets of log entries and writes the whole set in a single database transaction. This arrangement decouples the request handlers from the loggers, thereby eliminating the bottleneck introduced by the database.

For more information about using queues, see the Dynamo Foundation Classes chapter of the ATG Platform Programming Guide.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices