Re: [PATCHES] default resource limits

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: [PATCHES] default resource limits
Дата
Msg-id 43B87ADA.1080709@dunslane.net
обсуждение исходный текст
Ответ на Re: [PATCHES] default resource limits  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCHES] default resource limits  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>
>
>>In experimenting I needed to set this at 20 for it to bite much. If we
>>wanted to fine tune it I'd be inclined to say that we wanted
>>20*connections buffers for the first, say, 50  or 100 connections and 10
>>or 16 times for each connection over that. But that might be getting a
>>little too clever - something we should leave to a specialised tuning
>>tool. After all, we try these in fairly discrete jumps anyway. Maybe a
>>simple factor around 20 would be sufficient.
>>
>>
>
>I think 10 is probably a good compromise value.  If we set it to 20
>we'll find "make check" failing on Darwin because Apple's standard
>SHMMAX value doesn't allow more than about 300 buffers ... and the
>regression tests want max_connections to be at least 20.
>
>

Well, we could do something like:

#define MIN_BUFS_FOR_CONNS(nconns) ((nconns) <= 20 ? (nconns) * 10 : 200
+ (((nconns)  - 20) * 20))

But I'm happy just to live with 10 :-)


>I noticed while fooling with this on my laptop that initdb was selecting
>a shared_buffers value less than the value it had just proved would work
>:-(.  This is because the list of shared_buffers values it was probing
>did not include all the values corresponding to values tried during the
>max_connections scan.  I've added documentation about that gotcha.
>
>
>
>

That's easily fixed, I think. We just need to remember what we have
proved works.

I can apply the attached patch if you think that's worth doing.

Thanks for cleaning this up. The remaining question is whether to leave
the max connections tried at 100 on all platforms or bump it for those
that won't hurt from extra semaphore use. I can see arguments both ways
- I'm less concerned about this than the shared buffers numbers.

cheers

andrew

Index: initdb.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.103
diff -c -r1.103 initdb.c
*** initdb.c    31 Dec 2005 23:50:59 -0000    1.103
--- initdb.c    2 Jan 2006 00:52:58 -0000
***************
*** 1122,1128 ****
                  status,
                  test_conns,
                  test_buffs,
!                 test_max_fsm;

      printf(_("selecting default max_connections ... "));
      fflush(stdout);
--- 1122,1130 ----
                  status,
                  test_conns,
                  test_buffs,
!                 test_max_fsm,
!                 ok_buffers = 0;
!

      printf(_("selecting default max_connections ... "));
      fflush(stdout);
***************
*** 1144,1150 ****
--- 1146,1155 ----
                   DEVNULL, DEVNULL, SYSTEMQUOTE);
          status = system(cmd);
          if (status == 0)
+         {
+             ok_buffers = test_buffs;
              break;
+         }
      }
      if (i >= connslen)
          i = connslen - 1;
***************
*** 1158,1163 ****
--- 1163,1173 ----
      for (i = 0; i < bufslen; i++)
      {
          test_buffs = trial_bufs[i];
+         if (test_buffs <= ok_buffers)
+         {
+             test_buffs = ok_buffers;
+             break;
+         }
          test_max_fsm = FSM_FOR_BUFS(test_buffs);

          snprintf(cmd, sizeof(cmd),
***************
*** 1173,1181 ****
          if (status == 0)
              break;
      }
!     if (i >= bufslen)
!         i = bufslen - 1;
!     n_buffers = trial_bufs[i];
      n_fsm_pages = FSM_FOR_BUFS(n_buffers);

      printf("%d/%d\n", n_buffers, n_fsm_pages);
--- 1183,1189 ----
          if (status == 0)
              break;
      }
!     n_buffers = test_buffs;
      n_fsm_pages = FSM_FOR_BUFS(n_buffers);

      printf("%d/%d\n", n_buffers, n_fsm_pages);

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Doug Royer
Дата:
Сообщение: Re: EINTR error in SunOS
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCHES] default resource limits