Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebird.conf DefaultDbCachePages better description #7630

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

livius2
Copy link

@livius2 livius2 commented Jun 15, 2023

Hi. As many times on Firebird group is question about DefaultDbCachePages, i have written probably better description. Users ask why my server use so low memory even if i setup big value in config. They do not know how this cache work and that firebird.conf setting can be overrided by different one.

Please fill free to fix it as i am not native English

Hi. As many times on firebird group is question about DefaultDbCachePages, i have written probably better description.
Users ask why my server use so low memory even if i setup big value in config.
They do not know how this cache work and that firebird.conf setting can be overrided by different one.

Please fill free to fix it as i am not native English
builds/install/misc/firebird.conf Outdated Show resolved Hide resolved
builds/install/misc/firebird.conf Outdated Show resolved Hide resolved
# Per-database configurable. This value can be overrided by databases.conf or
# directly in database file by issuing command:
# gfix -b[uffers] BUFFERS
# Priority of setings is: direcly in database, databases.conf, firebird.conf.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Priority of settings is: directly in database, databases.conf, firebird.conf.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here one typo direcly should be directly

# Priority of settings is: directly in database, databases.conf, firebird.conf.
# The SuperServer default value is 2048 pages for each database and the classic
# value is 256 pages per client connection per database.
# As this value means maximum number of pages cached, at start server use minimal RAM.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Engine allocates all buffers at the attachment. It's true both for SuperServer and for ClassicServer. Therefore, SuperServer allocates all buffers at the first connection. ClassicServer allocates buffers for every attachment and this number depends on number of attachments.
I think suggested description is not complete as well and doesn't sole original question.

Copy link
Author

@livius2 livius2 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romansimakov
I did not observe such thing like SuperServer allocation of all buffers. I start server, connect to database and server still use low RAM. Only if i select from multiple tables it increase RAM usage. But i still use FB3. Maybe was some changes in recent version of FB?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romansimakov I did not observe such thing like SuperServer allocation of all buffers. I start server, connect to database and server still use low RAM. Only if i select from multiple tables it increase RAM usage. But i still use FB3. Maybe was some changes in recent version of FB?

What's your OS and how do you see? I'm afraid OS just doesn't allocate asked memory phisically and leaves it as virtually allocated. When engine addresses a memory page maps on phisical memory and from that time OS account it as used by the process.

For example, on my Ubuntu I can see the following for 2048 cache on SuperServer:

  1. Just after server start
roman:bin$ grep Vm /proc/`pidof rdbserver`/status 
VmPeak:	  470764 kB
VmSize:	  405680 kB
VmHWM:	   42504 kB
VmRSS:	   42504 kB
VmData:	   58240 kB
  1. After connect to a big (80GB) database:
    roman:bin$ grep Vm /proc/pidof rdbserver/status
VmPeak:	 1384600 kB
VmSize:	 1319452 kB
VmHWM:	   72432 kB
VmRSS:	   72432 kB
VmData:	  632884 kB
  1. After select from a big table:
    roman:bin$ grep Vm /proc/pidof rdbserver/status
VmPeak:	 1384600 kB
VmSize:	 1319068 kB
VmHWM:	  103860 kB
VmRSS:	  103860 kB
VmData:	  632500 kB
  1. After disconnect
    roman:bin$ grep Vm /proc/pidof rdbserver/status
VmPeak:	 1384600 kB
VmSize:	  764724 kB
VmHWM:	  103860 kB
VmRSS:	   40868 kB
VmData:	   90628 kB

Note how VmRSS and VmSize change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. it's controlled not by the Engine but by OS

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am working only on Windows, and i simply looked into TaskManager->Resource monitor
At start FB (SuperServer) show really low RAM usage, only when i do select from multiple tables it increase:
image

Copy link
Member

@dyemanov dyemanov Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get a difference between virtual memory and physical memory. When you allocate memory, virtual memory counter is increased. When you access that allocated memory, physical memory counter is increased. So Firebird allocates (read: reserves in virtual memory) the whole page cache at startup, but its usage (physical memory) will grow only when pages are read into the cache.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that talking about Phisical Memory usage is more interesting for people which read config values description and what they observe after FB start. But my text was only proposition of description, fill free to extend that info of Virtual Memory preservation and any other info which help to understand that parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants