Re: shared memory settings on MAC OS X
От | Brendan Duddridge |
---|---|
Тема | Re: shared memory settings on MAC OS X |
Дата | |
Msg-id | 8B947BD2-11D8-42CF-A14E-DCB895C7551E@clickspace.com обсуждение исходный текст |
Ответ на | Re: shared memory settings on MAC OS X (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-admin |
Either way, when you do manage to change your shared memory settings, you still won't be able to use more than about 4 GB of shared buffer space in Postgres, or any other program for that matter. We thought Leopard would help with this, but it hasn't. We have a 32 GB dual 3 Ghz Intel Xeon Xserve, but we can't set our shared buffers as high as we'd like. We also have a similarly spec'd Linux machine and it has no problem allowing us to specify lots of shared buffers. For some reason, OS X gives an error when you try to attach to anything more than 4 GB. Here's a program we wrote to demonstrate the problem, which we have submitted to Apple as a bug (Radar #5547628): /*** create_shared_memory.c ***/ /* Takes as input from standard in a size in bytes for a shared memory segment that this program will attempt to create and attach to. If any errors occur trying to create or attach to the shared memory, they are printed to standard out. This program will then attempt to detach from and delete the shared memory it allocated and/or attached to as appropriate. On Mac OS X 10.5 Server (9A557) on an Intel Quad core Xserve, compiling this program with gcc version i686-apple-darwin9-gcc-4.0.1 as follows #gcc -arch x86_64 create_shared_memory.c you will see the maximum shared memory segment that can be attached to is 4292870144. I do not know if this shared memory limit applies to the final version of Leopard Server or on other hardware. Note: You will need greater than 4GB of memory on your machine and large enough values set for kern.sysv.shmall and kern.sysv.shmmax to verify this shared memory limit. Known limitations: This program does not provide any output if the allocated shared memory cannot be deallocated or if the attached shared memory cannot be detached. Written by: Brian Wipf ClickSpace Interactive Inc. Date: October 18, 2007 */ #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/errno.h> typedef struct { int iPID; } shared_t; main() { int key = 912367102; /* Some random key for the shared memory segment. */ size_t size; int shmflg=IPC_CREAT | 0600; int shmid; shared_t *shared_mem; /* If you want to specify your own key, uncomment the next two lines of code. */ /* printf("Enter an integer key for shared memory segment: "); scanf("%d", &key); */ printf("Enter size for shared memory segment (in bytes): "); scanf("%ld", &size); /* Create the shared memory segment */ printf("\nAttempting to create the shared memory segment...\n"); shmid=shmget(key, size, shmflg); if (errno != 0) { printf("There was an error trying to allocate the requested amount of shared memory\n"); printf("errno: %d\n", errno); } else { printf("Shared memory created successfully\n"); /* Attach to the shared memory segment */ printf("\nAttempting to attach to the shared memory segment... \n"); shared_mem = (shared_t *) shmat ( shmid, 0, 0); if (errno != 0) { printf("Error trying to attach to the shared memory segment. \n"); printf("errno: %d\n\n", errno); } else { printf("Shared memory attached to successfully\n"); /* Detach from shared memory segment */ printf("\nDetaching from the shared memory segment\n\n"); shmdt(shared_mem); } /* Delete the shared memory segment */ printf("Deleting the shared memory segment\n"); shmctl(shmid, IPC_RMID, NULL); } return 0; } ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com On Oct 29, 2007, at 7:40 AM, Tom Lane wrote: > Maximilian Tyrtania <mty@fischerappelt.de> writes: >> Tom, I suspect you have Mac OS X Server installed, right? That's >> probably >> why your /etc/sysctl.conf file mentions that /etc/sysctl- >> macosxserver.conf >> file, while mine doesn't. > > Uh, no, I'm looking at my laptop. Curious that yours has no reference > to the other file. > >> And frankly, to me it looks as if it means "if there is a /etc/ >> sysctl.conf >> file, then read it and accept its settings. Then overwrite the sysctl >> settings with the default values, no matter what." > > You're forgetting the point I made that the first complete set of > shmem > settings wins. If we could change the settings on the fly after that, > all this would be a whole lot easier, but the OSX kernel locks them > down > somehow. > > BTW, I dunno if you read awk at all, but that awk command effectively > says "print lines that contain = and do not contain #". You didn't > try > appending comments to the setting lines in your file did you? > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster >
Вложения
В списке pgsql-admin по дате отправления:
Предыдущее
От: "Tena Sakai"Дата:
Сообщение: Re: idle in transaction...unexpected EOF on clientconnection