improving write performance for logging application

From: Steve Eckmann
Subject: improving write performance for logging application
Date: ,
Msg-id: 43BB0C5C.8020207@computer.org
(view: Whole thread, Raw)
Responses: Re: improving write performance for logging application  (Tom Lane)
Re: improving write performance for logging application  ("Steinar H. Gunderson")
Re: improving write performance for logging application  (Ian Westmacott)
List: pgsql-performance

Tree view

improving write performance for logging application  (Steve Eckmann, )
 Re: improving write performance for logging application  (Tom Lane, )
  Re: improving write performance for logging application  (dlang, )
   Re: improving write performance for logging application  (Steve Eckmann, )
  Re: improving write performance for logging application  (Steve Eckmann, )
   Re: improving write performance for logging application  (Tom Lane, )
    Re: improving write performance for logging application  (Steve Eckmann, )
 Re: improving write performance for logging application  ("Steinar H. Gunderson", )
  Re: improving write performance for logging application  (Steve Eckmann, )
   Re: improving write performance for logging application  (Kelly Burkhart, )
    Re: improving write performance for logging application  (Steve Eckmann, )
 Re: improving write performance for logging application  (Ian Westmacott, )
  Re: improving write performance for logging application  (Steve Eckmann, )
  Re: improving write performance for logging  (Ron, )
   Re: improving write performance for logging  (Ian Westmacott, )
    Re: improving write performance for logging  ("Jim C. Nasby", )
     Re: improving write performance for logging  (Ian Westmacott, )
      Re: improving write performance for logging  ("Jim C. Nasby", )
       Re: improving write performance for logging  (Ian Westmacott, )
        Re: improving write performance for logging  (Tom Lane, )
      Re: improving write performance for logging  (Michael Stone, )

I have questions about how to improve the write performance of PostgreSQL for logging data from a real-time simulation.
Wefound that MySQL 4.1.3 could log about 1480 objects/second using MyISAM tables or about 1225 objects/second using
InnoDBtables, but PostgreSQL 8.0.3 could log only about 540 objects/second. (test system: quad-Itanium2, 8GB memory,
SCSIRAID, GigE connection from simulation server, nothing running except system processes and database system under
test)

We also found that we could improve MySQL performance significantly using MySQL's "INSERT" command extension allowing
multiplevalue-list tuples in a single command; the rate for MyISAM tables improved to about 2600 objects/second.
PostgreSQLdoesn't support that language extension. Using the COPY command instead of INSERT might help, but since rows
arebeing generated on the fly, I don't see how to use COPY without running a separate process that reads rows from the
applicationand uses COPY to write to the database. The application currently has two processes: the simulation and a
datacollector that reads events from the sim (queued in shared memory) and writes them as rows to the database,
bufferingas needed to avoid lost data during periods of high activity. To use COPY I think we would have to split our
datacollector into two processes communicating via a pipe. 

Query performance is not an issue: we found that when suitable indexes are added PostgreSQL is fast enough on the kinds
ofqueries our users make. The crux is writing rows to the database fast enough to keep up with the simulation. 

Are there general guidelines for tuning the PostgreSQL server for this kind of application? The suggestions I've found
includedisabling fsync (done), increasing the value of wal_buffers, and moving the WAL to a different disk, but these
aren'tlikely to produce the 3x improvement that we need. On the client side I've found only two suggestions: disable
autocommitand use COPY instead of INSERT. I think I've effectively disabled autocommit by batching up to several
hundredINSERT commands in each PQexec() call, and it isn’t clear that COPY is worth the effort in our application. 

Thanks.



pgsql-performance by date:

From: "Virag Saksena"
Date:
Subject: Avoiding cartesian product
From: Ian Westmacott
Date:
Subject: Re: improving write performance for logging application