Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
6 replies Latest Post - ‏2013-03-02T20:58:53Z by SystemAdmin
SystemAdmin
SystemAdmin
5837 Posts
ACCEPTED ANSWER

Pinned topic Minimal lightweight configuration on Linux

‏2013-02-25T12:36:04Z |
Hi,

First, I'd like to explain I am not an experienced DB2 user, but a programmer who needs to run basic integration tests for an open source project against DB2.

I have successfully installed DB2 Express-C on Linux (Debian (wheezy), 32-bit) from db2_v1012_linuxia32_expc_lite.tar.gz package,
using db2setup and response file. Everything seems to run quite well.
However, the installation sits on a headless remote server with modest hardware resources (512MB/1024MB(burst) RAM, no swap).
I certainly don't intent to use this setup for production purposes or multi-user access.
My intention is to use it in the following simple scenario:

For each test case of N repeat:
1. Open connection
2. Execute DDL commands
3. Execute DML commands
4. Clean up
5. Close connection

This implies that single connection is opened at any time, no concurrent client sessions.
The tests execution time is not an issue, they can be run in slow manner.

Given the hardware resources I have at my disposal and the scenarios I'm going to run,
I'd like to learn how to tweak the DB2 Express-C configuration in order to minimalise its memory usage
without affecting DB2 processes health and minimum usability (i.e. avoid "SQL1084C Shared memory segments cannot be allocated. SQLSTATE=57019").

I have searched the forum archives and find answers to my questions, but mostly questions are related to upper limits of DB2 Express-C edition.
I'm concerned with lower limits.

So, here are my questions are:

1) What is minimum memory required to allow to single-client connectivity as explained above?
2) Is it possible to memory usage below 512MB, say to limit usage to 350MB or even 256MB?
3) How to identify and disable unused components (processes)?

Could anyone provide me with details on steps/commands to perform in order to achieve the lightweight setup as explained above?
Or, point relevant sections in the DB2 10.x documentation?
The current process/resources situation in bigger picture is this:


$ free -h total       used       free     shared    buffers     cached Mem:          1.0G        12M       1.0G         0B         0B         0B -/+ buffers/cache:        12M       1.0G Swap:           0B         0B         0B   $ db2start SQL1063N  DB2START processing was successful.   $ ps aux USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND root         1  0.0  0.0   2144   756 ?        Ss   04:45   0:00 init [2] root      3328  0.0  0.0   3700   984 ?        Ss   04:45   0:00 /usr/sbin/cron root      3500  0.0  0.1   6332  1072 ?        Ss   04:46   0:00 /usr/sbin/sshd root      3515  0.0  0.0   2456   884 ?        Ss   04:46   0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -stayaliv root      8077  0.0  0.2   9508  3064 ?        Ss   15:50   0:00 sshd: mloskot [priv] mloskot   8079  0.0  0.1   9508  1568 ?        R    15:50   0:00 sshd: mloskot@pts/0 mloskot   8080  0.0  0.3   6060  3464 pts/0    Ss   15:50   0:00 -bash root      9388  0.1  0.1   4540  1492 pts/0    S    16:07   0:00 su - db2inst1 db2inst1  9389  0.0  0.0   1796   556 pts/0    S    16:07   0:00 -su root      9487  1.8  2.8 396148 29552 pts/0    Sl   16:07   0:00 db2wdog db2inst1  9489  3.2  6.0 398332 63140 pts/0    Sl   16:07   0:00 db2sysc root      9490  0.0  2.6 373140 27564 pts/0    S    16:07   0:00 db2ckpwd root      9491  0.0  2.6 373140 27544 pts/0    S    16:07   0:00 db2ckpwd root      9492  0.0  2.6 373140 27544 pts/0    S    16:07   0:00 db2ckpwd db2inst1  9499  1.8  2.6 338452 27348 pts/0    S    16:07   0:00 db2vend (PD Vendor Process - 1) db2inst1  9507  7.3  2.1 150464 22288 pts/0    Sl   16:07   0:00 db2acd   ,0,0,0,1,0,0,0,0000,1,0,98be58,14,1e014,2,0,1, db2inst1  9511  0.0  0.1   4200  1084 pts/0    R+   16:07   0:00 ps aux   $ free -h total       used       free     shared    buffers     cached Mem:          1.0G       470M       554M         0B         0B         0B -/+ buffers/cache:       470M       554M Swap:           0B         0B         0B


The DB2 memory tracker says this (I have no deatabases yet):


$ db2mtrk -i -d Tracking Memory on: 2013/02/25 at 16:26:00   Memory 

for instance   other       fcmbp       monh 47.6M       768.0K      64.0K   No active databases   $ db2mtrk -i -p -m Tracking Memory on: 2013/02/25 at 16:26:08   Memory 

for instance   other       fcmbp       monh 125.6M      768.0K      384.0K   No active agents

Disclaimer:
I asked very similar question on Oracle forums (1) regarding Oracle XE,
as I need to test Oracle as well and I have no experience as database systems administrator.
It is not my intention to compare database systems.
(1) https://forums.oracle.com/forums/thread.jspa?messageID=10862813
Best regards,
Updated on 2013-03-02T20:58:53Z at 2013-03-02T20:58:53Z by SystemAdmin
  • nivanov1
    nivanov1
    53 Posts
    ACCEPTED ANSWER

    Re: Minimal lightweight configuration on Linux

    ‏2013-02-25T12:58:54Z  in response to SystemAdmin
    I believe DB2 will be installed by default with self-tuning memory switched on, so no additional tuning is required. If you want to limit memory available to DB2 you can set an explicit limit to either INSTANCE_MEMORY or DATABASE_MEMORY.

    For more information: http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.dbobj.doc/doc/c0053287.html
    • SystemAdmin
      SystemAdmin
      5837 Posts
      ACCEPTED ANSWER

      Re: Minimal lightweight configuration on Linux

      ‏2013-02-26T21:19:33Z  in response to nivanov1
      Hi,

      Thanks for the suggestions.

      I have played with INSTANCE_MEMORY.
      Quick observation, setting it to 256MB allows to db2start, but CREATE DATABASE or CONNECT TO was not succeeding due to memory allocation failure.

      So, I eventually applied these basic settings:

      
      update dbm cfg using instance_memory 98304 immediate update dbm cfg using num_initagents 5 update dbm cfg using numdb 3
      

      Mateusz Loskot, http://mateusz.loskot.net/
      • SystemAdmin
        SystemAdmin
        5837 Posts
        ACCEPTED ANSWER

        Re: Minimal lightweight configuration on Linux

        ‏2013-02-27T03:00:27Z  in response to SystemAdmin
        I think you can get by with 1GB memory allocation for the instance. The smallest test instance I have running is 700 MB (out of the box , not much fiddling with cfg) for express-C 9.5 .
        • SystemAdmin
          SystemAdmin
          5837 Posts
          ACCEPTED ANSWER

          Re: Minimal lightweight configuration on Linux

          ‏2013-02-27T10:37:48Z  in response to SystemAdmin
          @dattark The thing is, I'm trying to get by with sub 512MB RAM.
          If I go lower than 380-390MB, regardless how I tweak kernel shared memory parameters, I always get "SQL1084C Shared memory segments cannot be allocated. SQLSTATE=57019" at CREATE DATABASE or CONNECT TO attempts.
          Anyway, it's valuable experience and lesson to learn what are about minimal requirements and feasible limits in practice

          Mateusz Loskot, http://mateusz.loskot.net/
          • SystemAdmin
            SystemAdmin
            5837 Posts
            ACCEPTED ANSWER

            Re: Minimal lightweight configuration on Linux

            ‏2013-02-28T03:02:51Z  in response to SystemAdmin
            I hear you about your memory constraints.

            Out of curiosity is your VPS running on OpenVZ or a LXC type of container based VPS ?

            Cannot allocate Shared memory error somehow rings of OpenVZ.

            Here are some old links may or may not be helpful to your quest:

            http://forum.openvz.org/index.php?t=msg&goto=25500

            http://listserv.sap.com/pipermail/linux.general/2005-January/004486.html

            Some more old stuff:
            http://www.ibm.com/developerworks/data/library/techarticle/dm-0406qi/
            • SystemAdmin
              SystemAdmin
              5837 Posts
              ACCEPTED ANSWER

              Re: Minimal lightweight configuration on Linux

              ‏2013-03-02T20:58:53Z  in response to SystemAdmin
              @dattark Yes, it's OpenVZ. Thank you for these pointers. They look relevant indeed. I'm going to try those suggestions soon.

              Mateusz Loskot, http://mateusz.loskot.net/