Subject 1.8Gb database performance issues
Author mailgroupza
Hi

We have an application which has worked well for a few years now but
we are now
seeing a huge degradation in performance.

Server: Dedicated to firebird Dell 2850 8GB Ram, 2 x 3.6Ghz xeon
processors, Raid 5
OS: Mandrake linex 2.6.11

Database: 1.8 Gb (single db)

Firebird: Ver 1.5

The current settings which I think are relevant are as follows:
#SortMemBlockSize = 1048576
#SortMemUpperLimit = 67108864
#CpuAffinityMask = 1
DefaultDbCachePages = 8192

Below is the configutation file for reference

Any ideas on improving performance would be greatly appreciated

Regards Cao


#######################################
#
# Firebird configuration file
#
# Comments
# --------
# The # character is used for comments and can be placed anywhere on a
# line. Anything following the # character on a line is considered a
# comment.
#
# Examples:
#
# # This is a comment
DefaultDbCachePages = 8192 # This is an end-of-line comment
#
# Entries
# -------
# The default value for each entry is listed to the right of the "=".
# To activate an entry, remove the leading "#"s and supply the desired
# value.
#
# Please note, a number of the values are specified in **Bytes** (Not
KB).
# Accordingly, we have provided some simple conversion tables at the
bottom
# of this file.
#
# There are three types of configuration values: integer, boolean and
string.
#
# Integer
# --------
# Integers is what they sound like, an integral value. Examples:
# 1
# 42
# 4711
#
# Boolean
# -------
# Boolean is expressed as integer values with 0 (zero) being "false"
and
# non-zero is taken to mean "true". For consistency we recommend you
# only use 0/1.
#
# String
# ------
# Strings are also what they sound like, strings. Examples:
# RootDirectory = /opt/firebird
# RemotePipeName = pipe47
#
#
# Portions of this file have been reproduced/made available with the
# permission of Ann Harrison @ IBPhoenix.
#
#######################################

# ==================================
# Settings for all platforms/engines
# ==================================
#
# ----------------------------
# Specify the root directory under which Firebird is installed.
# Can be used to override the OS-specifically determined one.
#
# Type: string
#
#RootDirectory =


# ----------------------------
# Database Paths/Directories
#
# DatabaseAccess may be None, Full or Restrict. If you choose
Restrict,
# provide ';'-separated trees list, where database files are stored.
# Relative paths are treated relative to RootDirectory entry
# (see above). Default value 'Full' gives full access to all files
# on your site. To specify access to specific trees, enum all required
# paths (for Win32 this may be something
like 'C:\DataBase;D:\Mirror',
# for unix - '/db;/mnt/mirrordb'). If you choose 'None', then only
# databases listed in aliases.conf can be attached.
#
# UNCONTROLLED DATABASE ACCESS MAY COMPROMISE YOUR SYSTEM!
# IT IS STRONGLY RECOMMENDED THAT THIS SETTING BE USED TO LIMIT
# DATABASE LOCATIONS!
#
# Type: string (special format)
#
#DatabaseAccess = Full


# ----------------------------
# External File Paths/Directories
#
# ExternalFileAccess may be None, Full or Restrict. If you choose
# Restrict, provide ';'-separated trees list, where external files
# are stored. Relative paths are treated relative to RootDirectory
entry
# (see above). Default value 'None' disables any use of external files
# on your site. To specify access to specific trees, enum all required
# paths (for Win32 this may be something like 'C:\ExternalTables',
# for unix - '/db/extern;/mnt/extern').
#
# NOTE: THE EXTERNAL TABLE ENGINE FEATURE COULD BE USED TO COMPROMISE
# THE SERVER/HOST AS WELL AS DATABASE SECURITY!!
#
# IT IS STRONGLY RECOMMENDED THAT THIS SETTING BE USED TO LIMIT
# EXTERNAL TABLE LOCATIONS!
#
# Type: string (special format)
#
ExternalFileAccess = Full


# ----------------------------
# External Function (UDF) Paths/Directories
#
# UdfAccess may be None, Full or Restrict. If you choose
# Restrict, provide ';'-separated trees list, where UDF libraries
# are stored. Relative paths are treated relative to RootDirectory
entry
# (see above). Default value 'Restrict UDF' provides the same
restrictions
# as in FB 1.0. To specify access to specific trees, enum all required
# paths (for Win32 this may be something like 'C:\ExternalFunctions',
# for unix - '/db/extern;/mnt/extern').
#
# NOTE: THE EXTERNAL FUNCTION ENGINE FEATURE COULD BE USED TO
COMPROMISE
# THE SERVER/HOST AS WELL AS DATABASE SECURITY!!
#
# IT IS STRONGLY RECOMMENDED THAT THIS SETTING BE USED TO LIMIT
# EXTERNAL FUNCTION LOCATIONS! SPECIALLY AVOID HAVING
# COMMON SUBTREES IN UdfAccess & ExternalFileAccess !
#
# Type: string (special format)
#
UdfAccess = Restrict UDF


# ----------------------------
# Temporary directories
#
# Provide ';'-separated trees list, where temporary files are stored.
# Relative paths are treated relative to RootDirectory entry
# (see above). Default value is determined using FIREBIRD_TMP,
# TEMP or TMP environment options. Every directory item may have
optional
# size argument to limit its storage, this argument follows the
directory
# name and must be separated by at least one space character. If the
size
# argument is omitted or invalid, then all available space in this
# directory will be used.
#
# E.g.:
# TempDirectories = c:\temp
# or
# TempDirectories = c:\temp;d:\temp
# or
# TempDirectories = c:\temp 100000000;d:\temp 500000000;e:\temp
#
# Type: string (special format)
#
#TempDirectories =


# ----------------------------
# Number of cached database pages
#
# This sets the number of pages from any one database that can be held
# in cache at once. If you increase this value, the engine will
# allocate more pages to the cache for every database. By default, the
# SuperServer allocates 2048 pages for each database and the classic
# allocates 75 pages per client connection per database.
#
# Type: integer
#
#DefaultDbCachePages = 2048


# ----------------------------
# In-memory sorting module
#
# The amount of memory allocated for each sort block.
#
# Type: integer
#
#SortMemBlockSize = 1048576

#
# The maximum amount of memory to be allocated by the in-memory
# sorting module.
#
# For Classic servers, this setting is defaulted to 8 MB.
# Although it can be increased, the value applies to each client
# connection/server instance and thus consumes a lot of memory.
#
# Type: integer
#
#SortMemUpperLimit = 67108864


# ----------------------------
# Backward-compatible parameter ordering as it was in FB v1/IB
#
# Type: boolean
#
#OldParameterOrdering = 0


# ----------------------------
# Boolean evaluation method (complete or shortcut)
#
# If your SQL code depends on side-effects of full evaluation of OR
# and AND statements (right-hand-side terms), even if the expressions
# final result could be determined by just examining the value of the
# first term, you might need to turn this on.
#
# Type: boolean
#
#CompleteBooleanEvaluation = 0


# ----------------------------
#
# Determines the number of seconds that the lock manager will wait
after a
# conflict has been encountered before purging locks from dead
processes
# and doing extra deadlock scan cycle. Engine detects deadlocks
instantly
# in all normal cases, so this value affects things only if something
goes
# wrong. Setting it too low may degrade system performance.
#
# Type: integer
#
#DeadlockTimeout = 10


# ----------------------------
#
# How often the pages are flushed on disk
# (for databases with ForcedWrites=Off only)
#
# Number of unflushed writes which will accumulate before they are
# flushed, at the next transaction commit. For non-Win32 ports,
# the default value is -1 (Disabled)
#
# Type: integer
#
#MaxUnflushedWrites = 100

#
# Number of seconds during which unflushed writes will accumulate
# before they are flushed, at the next transaction commit. For non-
Win32
# ports, the default value is -1 (Disabled)
#
# Type: integer
#
#MaxUnflushedWriteTime = 5


# ----------------------------
#
# This option controls whether to call abort() when internal error or
BUGCHECK
# is encountered thus invoke post-mortem debugger which can dump core
suitable
# for off-line analysis. When disabled engine tries to minimize
damage and
# continue execution.
#
# Note that setting this option to 1 makes engine produce traceable
coredumps
# when something nasty like SIGSEGV happens inside UDF. On Windows
enabling
# this option makes engine invoke JIT debugger facilities when errors
happen.
#
# Type: boolean
#
#BugcheckAbort = 0


# ----------------------------
#
# Prior to Firebird 1.5 various SELECT expressions generated unnamed
# columns. This did not conform to the SQL standard. Fb 1.5 saw the
# introduction of default aliases for these unnamed columns. In some
# cases, particularly if string concatenation is used (via the ||
# operator) this breaks existing scripts.
#
# This setting will affect aliases generated via CONCATENATION,
# CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP and EXTRACT. Setting
# the value to true will disable the alias generation. It is only
# recommended to be used where legacy scripts need to be supported.
# It will be marked deprecated in Firebird 2.0 and removed in
# Firebird 3.0.
#
# Type: boolean
#
#OldColumnNaming = 0


# ----------------------------
# Client Connection Settings (Basic)
#
# Seconds to wait before concluding an attempt to connect has failed.
#
# Type: integer
#
#ConnectionTimeout = 180

#
# Seconds to wait on a silent client connection before the server
sends
# dummy packets to request acknowledgment.
#
# DO NOT USE THIS OPTION. It may hang or crash Windows on the client
side as
# explained here: http://support.microsoft.com/default.aspx?
kbid=296265
# or may not prevent eventual inactive client disconnection for other
OS.
#
# Normally, Firebird uses SO_KEEPALIVE socket option to keep track of
# active connections. If you do not like default 2-hour keepalive
timeout
# then adjust your server OS settings appropriately. On UNIX-like
OS's,
# modify contents of /proc/sys/net/ipv4/tcp_keepalive_*. On Windows,
# follow instrutions of this article:
# http://support.microsoft.com/default.aspx?kbid=140325
#
# Type: integer
#
#DummyPacketInterval = 0


# ----------------------------
# TCP Protocol Settings
#
# The TCP Service name/Port number to be used for client database
# connections.
#
# It is only necessary to change one of the entries, not both. The
# order of precendence is the 'RemoteServiceName' (if an entry is
# found in the 'services.' file) then the 'RemoteServicePort'.
#
# Type: string, integer
#
#RemoteServiceName = gds_db
#RemoteServicePort = 3050

#
# The TCP Port Number to be used for server Event Notification
# messages. The value of 0 (Zero) means that the server will choose
# a port number randomly.
#
# Type: integer
#
#RemoteAuxPort = 0

#
# TCP/IP buffer size for send and receive buffers of both the client
# and server. The engine reads ahead of the client and can send
# several rows of data in a single packet. The larger the packet size,
# the more data is sent per transfer. Range is 1448 to 32768.
#
# Type: integer
#
#TcpRemoteBufferSize = 8192

#
# Either enables or disables Nagle algorithm (TCP_NODELAY option of
# socket) of the socket connection.
#
# Note: Currently this is only active for super server, classic
# server needs an extra wrapper program.
#
# Type: boolean
#
#TcpNoNagle = 0

#
# Allows incoming connections to be bound to the IP address of a
# specific network card. It enables rejection of incoming connections
# through any other network interface except this one. By default,
# connections from any available network interface are allowed.
#
# Type: string
#
#RemoteBindAddress =


# ----------------------------
# Locking and shared memory parameters
#
# Bytes of shared memory allocated for lock manager.
# In Classic mode, the size given is used for the initial allocation.
The
# table expands dynamically up to the limit of memory. In
SuperServer, the
# initial size is also the final size.
# Default is 96K on Linux and Solaris, 256K on Windows.
#
# Type: integer
#
#LockMemSize = 262144

#
# Number of semaphores for interprocess communication.
# In non-threading environments, this sets the number of semaphores
# available
#
# Type: integer
#
#LockSemCount = 32

#
# When a connection wants to lock an object, it gets a lock request
# block which specifies the object and the lock level requested. Eack
# locked object has a lock block. Request blocks are connected to
those
# lock blocks either as requests that have been granted, or as pending
# requests.
#
# The settings:
# 1 means locks are granted first come, first served.
# 0 means emulate InterBase v3.3 behavior, where locks are
granted
# as soon as they are available; can result in lock request
# starvation.
#
# Type: integer/boolean
#
#LockGrantOrder = 1

#
# In Classic, only one client process may access the lock table at any
# time. Access to the lock table is governed by a mutex. The mutex can
# be requested conditionally - a wait is a failure and the request
must
# be retried - or unconditionally - the request will wait until it is
# satisfied. This parameter establishes the number of attempts that
# will be made conditionally. Zero value means unconditional mode.
# Relevant only on SMP machines.
#
# Type: integer
#
#LockAcquireSpins = 0

#
# Tune lock hash list; more hash slots mean shorter hash chains. Only
# necessary under very high load. Prime number values are recommended.
#
# Type: integer
#
#LockHashSlots = 101

# ----------------------------
#
# Bytes of shared memory allocated for event manager.
#
# Type: integer
#
#EventMemSize = 65536


# ===========================
# SuperServer Engine Settings
# ===========================
#
# ----------------------------
# Which CPUs should be used (Windows Only)
#
# In an SMP system, sets which processors can be used by the server.
# The value is taken from a bit map in which each bit represents a
CPU.
# Thus, to use only the first processor, the value is 1. To use both
# CPU 1 and CPU 2, the value is 3. To use CPU 2 and CPU 3, the value
# is 6. The default value is 1.
#
# Type: integer
#
#CpuAffinityMask = 1


# ----------------------------
# Settings for the thread scheduler (Windows Only)
#
# The wait time, in milli-seconds (ms), before the priority of:
# - an inactive thread is reduced to 'Low', or
# - an active thread is increased to 'High'
#
# Note: The default value was chosen based on experiments on Intel
# PIII/P4 processors. It should be increased for using in the
computer
# with lower speed processors.
#
# Type: integer
#
#PrioritySwitchDelay = 100

#
# Number of cycles of the scheduler (PrioritySwitchDelay ms) before
# thread are destroyed/closed. Rather than immediately destroy/closed
# worker threads (which would require a semaphore and blocking call --
# significant overhead), the thread scheduler maintains a pool of the
# threads. When a thread has completed it's task/work, it is marked
as
# idle. The idle thread is destroyed/closed after X iterations of the
# scheduler loop.
#
# For a server with a very large number of connections (presumably
more
# than several hundred) the setting value should be increased.
#
# The setting represents the number of loop iterations to be made
before
# the thread is destroyed/closed.
#
# Type: integer
#
#DeadThreadsCollection = 50

#
# Number of additional 'intervals' given to a 'High' priority thread.
#
# Type: integer
#
#PriorityBoost = 5


# ==============================
# Classic Server Engine Settings
# ==============================
#


# ==============================
# Settings for Windows platforms
# ==============================
#
# ----------------------------
# Does the guardian restart the server every time it crashes?
# 0 - only start the engine/service once
# 1 - always restart the engine/service if it terminates
#
# Type: integer/boolean
#
#GuardianOption = 1


#
# ----------------------------
# Priority level/class for the server process.
#
# The values are:
# 0 (Zero) - normal priority,
# positive value - high priority (same as -B command line option)
# negative value - low priority.
#
# Note: All changes to this value should be carefully tested to ensure
# that engine is more responsive to requests.
#
# Type: integer
#
#ProcessPriorityLevel = 0


# ----------------------------
# Local Connection Settings
#
# Size in bytes of one client's portion of the memory mapped file used
# for local connections.
#
# Type: integer
#
#IpcMapSize= 4096

#
# The name of the shared memory area used as a transport channel in
local protocol.
# The default value is not compatible with IB/FB1. Use
value 'InterBaseIPI' to
# restore compatibility, if necessary.
#
# Type: string
#
#IpcName = FirebirdIPI

#
# The name of the pipe used as a transport channel in NetBEUI
protocol.
# Has the same meaning as a port number for TCP/IP. The default value
is
# compatible with IB/FB1.
#
# Type: string
#
#RemotePipeName = interbas

#
# Does the server need to create a (hidden) window used for IPC
communication.
# Turn this off to run the server without a window and hence without
local protocol.
# Can be used for running a few instances of the server
simultaneously on win32.
#
# Type: boolean
#
#CreateInternalWindow = 1


# ============================
# Settings for Unix/Linux platforms
# ============================
#
#
# UNIX signal to use for interprocess communication
#
# Type: integer
#
#LockSignal = 16


# ----------------------------
# Remove protection against opening databases on NFS mounted volumes
#
# ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING***
#
# This option removes an important safety feature of Firebird and can
# cause irrecoverable database corruption. Do not use this option
unless
# you understand the risks and are prepared to accept the loss of the
# contents of your database.
# Unless this configuration option is changed from 0 to 1, Firebird
can
# open a database only if the database is stored on a drive
physically
# attached to the local computer – the computer running that copy of
# Firebird. Requests for connections to databases stored on NFS
mounted
# drives are redirected to a Firebird server running on the computer
that
# "owns" the disk.
# This restriction prevents two different copies of Firebird from
opening
# the same database without coordinating their activities.
Uncoordinated
# access by multiple copies of Firebird will corrupt a database. On a
local
# system, the system-level file locking prevents uncoordinated access
to
# the database file.
# NFS does not provide a reliable way to detect multiple users of a
file on
# an NFS mounted disk. If a second copy of Firebird connects to a
database on
# an NFS mounted disk, it will corrupt the database.
# Under some circumstances, running a Firebird server on the computer
that
# owns NFS mounted volumes is inconvenient or impossible.
Applications that
# use the "embedded" variant of Firebird and never share access to a
database
# can use this option to permit direct access to databases on NFS
mounted
# volumes.
# DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING.
#
# Type: boolean
#
#RemoteFileOpenAbility = 0


#######################################
#
# KB to Bytes Conversion table
#
#######################################
#
# KB Bytes KB Bytes
# ---- --------- ---- ---------
# 1 1024 32 32768
# 2 2048 64 65536
# 4 4096 128 131072
# 8 8192 256 262144
# 16 16384 512 524288
#
#######################################
#
# MB to Bytes Conversion table
#
#######################################
#
# MB Bytes MB Bytes MB Bytes
# --- --------- --- ----------- --- -----------
# 1 1048576 64 67108864 448 469762048
# 2 2097152 128 134217728 512 536870912
# 4 4194304 192 201326592 640 671088640
# 8 8388608 256 268435456 768 805306368
# 16 16777216 320 335544320 896 939524096
# 32 33554432 384 402653184 1024 1073741824
#