Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369

    Unanswered: Using local loopback instead of hostname in db2nodes.cfg

    This question comes from a DBA.

    DB2 v9.1 with DPF on AIX
    one physical machine with multiple logical partitions


    For example,

    /etc/hosts contains:
    127.0.0.1 loopback localhost # loopback (lo0) name/address
    9.29.120.15 panipuri.torolab.ibm.com panipuri


    Currently, db2nodes.cfg looks like:
    1 panipuri 0
    2 panipuri 1


    I can change it to look like:
    1 loopback 0
    2 loopback 1


    Or

    1 localhost 0
    2 localhost 1


    Or

    1 127.0.0.1 0
    2 127.0.0.1 1


    Has anyone ever used the local loopback interface instead of hostname in the db2nodes.cfg? Is this a legitimate way to speed up FCM traffic?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    What you are suggesting might work, but it won't speed up anything. Because you have a version of DB2 prior to 9.5 (9.1 or earlier) running on AIX, to have DB2 bypass the socket interface when communicating with other partitions on the same physical node, use this environment variable:

    db2set DB2_FORCE_FCM_BP=YES

    If the DB2_FORCE_FCM_BP variable is set to Yes, the FCM buffers are always created in a separate memory segment so that communication between FCM daemons of different logical partitions on the same physical node occurs through shared memory. Otherwise [without this variable set to Yes], FCM daemons on the same node communicate through UNIX Sockets. Communicating through shared memory is faster, but there is one fewer shared memory segment available for other uses, particularly for database buffer pools. Enabling the DB2_FORCE_FCM_BP registry variable thus reduces the amount of memory available for database buffer pools.

    However, the above setting is discontinued in V9.5 since the new default is to enable shared memory communications between logical nodes to improve performance. But since you are still on 9.1 on AIX, you should set the above environment variable to Yes.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    Thanks.

    DB2_FORCE_FCM_BP is set to YES by default in v9.1. So, if DB2_FORCE_FCM_BP is set to YES, will changing hostname with loopback localhost help to speed up FCM traffic? Or the only way to speed up FCM traffic is to use the netname/switch in the db2nodes.cfg?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by db2girl
    Thanks.

    DB2_FORCE_FCM_BP is set to YES by default in v9.1. So, if DB2_FORCE_FCM_BP is set to YES, will changing hostname with loopback localhost help to speed up FCM traffic? Or the only way to speed up FCM traffic is to use the netname/switch in the db2nodes.cfg?
    The switch entry is for a private or secondary physical network that you can setup and define for inter-partition communications on different machines. I don't believe that it is affected by whether you use the hostname vs. loopback specification for either the public or private network (when the hostname is the local machine). Obviously, the private network is only used between physical nodes, and when communicating between partitions on the same physical node you want DB2 to use the FCM buffers instead of the UNIX TCP/IP sockets.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    Thanks for clarifying.

    If there is:
    - only one physical machine with multiple logical partitions
    - DB2_FORCE_FCM_BP is set to YES (one shared memory segment is used for FCM resources and all logical partitions on that physical machine will share this)


    Original db2nodes.cfg:
    1 panipuri 0
    2 panipuri 1


    Modified db2nodes.cfg:
    1 127.0.0.1 0
    2 127.0.0.1 1


    Do you think modifying db2nodes.cfg as per above will make communication between logical partitions on the same physical machine faster?

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    I was told by one knowledgeable person at IBM that it would be better to use the fully qualified hostname (with domain suffix) as in option number 1 below. But I am not sure if it makes a difference if the domain and ip address information is in the /etc/hosts file. It would make a difference if the DNS server was required to resolve the ip address.

    Alternative 1 (recommended by IBM to me):

    1 panipuri.torolab.ibm.com 0
    2 panipuri.torolab.ibm.com 1

    Not sure if using the hard-code ip address is the same as the fully qualified host name in alternative 1 above, or if option number 2 is the same as using the loopback ip address.

    Alternative 2 (hard-coded ip address):
    1 9.29.120.15 0
    2 9.29.120.15 1

    Of course, once DB2 figures out that these logical nodes are on the same server, then the FCM buffers will be used instead of the UNIX sockets. So the only issue here is hostname resolution.

    Your customer could do a test and see if there is a difference. The test would need to involve a significant amount of data collocation during the SQL statement, such as joining two large tables that have different partitioning keys.
    Last edited by Marcus_A; 09-05-09 at 04:52.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  7. #7
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    Thanks, Marcus. The manual does mentions that the fully qualified hostname needs to be used in the db2nodes.cfg. Starting with v9.1, using short name may cause some delays when resolving the hostname if the /etc/hosts file contains only short names.

    IBM - IY53322: DOCUMENT REQUIREMENT FOR FULLY-QUALIFIED HOSTNAMES IN DB2
    IBM - IZ09585: DB2 COMMANDS IN DB2 VERSION 9.1 AND LATER THAT REQUIRE HOSTNAME RESOLUTION MIGHT EXPERIENCE UNEXPECTED DELAYS.

    The same information is in the manual.


    This DBA has machine's short name in the db2nodes.cfg and I think their hosts file looks similar to the one in my example. What he wanted to know if replacing machine's short name with the loopback (127.0.0.1) will help to speed up FCM traffic. I've never seen any customers who use this in the db2nodes.cfg... I'll pass your information to the DBA who asked this question and may also check with other people to see what they have to say about it. May be Mr. DBA will decide to join the forum and ask further questions and/or provide feedback


    Thanks

  8. #8
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Just to summarize, there are two separate issues here:

    1. Using IP address, vs. hostname, vs. fully qualified hostname. As mentioned above the fully qualified hostname is preferred, but not sure how that compares with IP address.

    2. Using localhost vs. hostname/IP address to speed up communications with partitions on the same physical machine. This clearly does not need to be done because the FCM buffers are used for that purpose (to bypass the sockets layer).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  9. #9
    Join Date
    Aug 2009
    Posts
    42
    Marcus, you wrote:
    So the only issue here is hostname resolution.


    How is the hostname resolution performed? Is it done by DB2 or AIX?

  10. #10
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by rdba
    Marcus, you wrote:
    So the only issue here is hostname resolution.

    How is the hostname resolution performed? Is it done by DB2 or AIX?
    I am not sure I understand the question, since DB2 cannot do that completely by itself. If the full domain suffix is included in the db2nodes.cfg, then it is not an issue, so that is what should be done.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  11. #11
    Join Date
    Aug 2009
    Posts
    42
    I'm not familiar with the host name resolution? What does it mean? Changing host name to IP address?

  12. #12
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by rdba
    I'm not familiar with the host name resolution? What does it mean? Changing host name to IP address?
    You don't need to know. If you are using DPF Data Partitioning Feature (not the same as table partitioning) then code the hostnames in the db2nodes.cfg with the full domain suffix as described in the posts above. That is all you need to know.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  13. #13
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    I think DB2 will use gethostbyname() to do hostname resolution in most cases. For AIX, you can read about it here:
    pSeries and AIX Information Center


    Based on my understanding, this routine will return fully qualified hostname and resolve it to an IP address. Here is a sample program you can try:


    more myhost.c
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <unistd.h>
    #include <netdb.h>
    #include <stdio.h>
    int main (int argc, char *argv[])
    {
    char *host, **addrs;
    struct hostent *hostinfo;
    host = argv[1];
    hostinfo = gethostbyname(host);
    if(!hostinfo) {
    fprintf(stderr, "No host info retrieved.: %s\n", host);
    exit(1);
    }
    printf ("Information for hostname: %s\n", host);
    printf ("Name: %s\n", hostinfo->h_name);
    addrs = hostinfo->h_addr_list;
    while(*addrs) {
    printf ( "%s", inet_ntoa(*(struct in_addr *) *addrs));
    addrs++;
    }
    printf("\n");
    exit(0);
    }



    Output from executing "myhost panipuri":

    Information for hostname: panipuri
    Name: panipuri.torolab.ibm.com
    9.29.120.15


    If you need more info about hostname resolution/gethostbyname, please talk to your system people

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •