Subject Re: Performance lost with lots of connections
Author simonbenedicic
--- In, "selensky" <selensky@...> wrote:
> > One little thing you can do is to set Sweep to 0, and then start
> Sweep
> > manually when there is less traffic on the server (I have .bat file
> Thanks, probably a nice idea.
> How much does the sweep affect the performance (during a sweep)?
> Maybe that'll explain some of the really sudden performance drops?


It depends on amount of records that have to be removed from database.
Sweep can take 1 CPU to 100% for a while, but not for long (it takes a
little more time if database is configured with forced writes).

If you control the time when sweep runs then you can eliminate this
factor :-)

There is also garbage collection that can run anytime that engine sees
old versions of the records and decides to mark it for removing from
database. Garbage collection can be fired a few ways ... for example
with counting records in a table [select count(*) from table]. That
kind of sql can take time because of several reasons:
- a lot of records :-)
- little active records, and a lot of deleted records that cannot be
collected with garbage collector because of the transaction gap (note
that engine still have to read old versions of records in this case).
- little active records, and a lot of deleted records that fired
garbage collection.

In our application we disconnect all users at midnight (users forget
to close application) and then we start sweep, this way we have a
clean and good performing database every morning.