Re: [PERFORM] Swapping on Solaris
po and pi are relatively low, but do pick up when there's an increase in activity. I am seeing a lot of minor faults, though. vmstat -S 5 reports [9:38am]# vmstat -S 5 procs memorypagedisk faults cpu r b w swap free si so pi po fr de sr s0 s1 s3 -- in sy cs us sy id 0 0 0 3235616 1414536 0 0 303 11 10 0 0 6 24 0 0 13 192 461 17 11 72 1 0 0 3004376 1274912 0 0 0 0 0 0 0 3 16 0 0 494 1147 441 52 25 23 494 in faults 1147 sy faults Generally faults are a bad thing. Is that the case here? Kevin - Original Message - From: Matt Casters [EMAIL PROTECTED] To: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 3:57 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: It looks to me like you are using no (device or file) swap at all, and have 1.3G of real memory free, so could in fact give Postgres more of it :-) Indeed. If you DO run into trouble after giving Postgres more RAM, use the vmstat command. You can use this command like vmstat 10. (ignore the first line) Keep an eye on the pi and po parameters. (kilobytes paged in and out) HTH, Matt -- Matt Casters [EMAIL PROTECTED] i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED]) ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PERFORM] Swapping on Solaris
I take that back. There actually is some paging going on. I ran sar -g 5 10 and when a request was made (totally about 10 DB queries) my pgout/s jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also jumped to 121.80. Kevin - Original Message - From: Matt Casters [EMAIL PROTECTED] To: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 3:57 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: It looks to me like you are using no (device or file) swap at all, and have 1.3G of real memory free, so could in fact give Postgres more of it :-) Indeed. If you DO run into trouble after giving Postgres more RAM, use the vmstat command. You can use this command like vmstat 10. (ignore the first line) Keep an eye on the pi and po parameters. (kilobytes paged in and out) HTH, Matt -- Matt Casters [EMAIL PROTECTED] i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED]) ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [PERFORM] Swapping on Solaris
I suspect that the memory is being used to cache files as well since the email boxes are using unix mailboxes, for the time being. With people checking their email sometimes once per minute I can see why Solaris would want to cache those files. Perhaps my question would be more appropriate to a Solaris mailing list since what I really want to do is get Solaris to simply allow PostgreSQL to use more RAM and reduce the amount of RAM used for file caching. I would have thought that Solaris gives some deference to a running application that's being swapped than for a file cache. Is there any way to set custom parameters on Solaris' file-caching behavior to allow PostgreSQL to use more physical RAM? I will also check out memstat. It's not on my system, but I'll get it from the site you noted. Thanks Kevin - Original Message - From: Alan Stange [EMAIL PROTECTED] Cc: Kevin Schroeder [EMAIL PROTECTED]; pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 7:51 AM Subject: Re: [PERFORM] Swapping on Solaris Mark Kirkwood wrote: Kevin Schroeder wrote: Ignoring the fact that the sort and vacuum numbers are really high, this is what Solaris shows me when running top: Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free Maybe check the swap usage with 'swap -l' which reports reliably if any (device or file) swap is actually used. I think Solaris 'top' does some strange accounting to calculate the 'swap in use' value (like including used memory). It looks to me like you are using no (device or file) swap at all, and have 1.3G of real memory free, so could in fact give Postgres more of it :-) I suspect that free memory is in fact being used for the file system cache. There were some changes in the meaning of free in Solaris 8 and 9. The memstat command gives a nice picture of memory usage on the system. I don't think memstat came with Solaris 8, but you can get it from solarisinternals.com. The Solaris Internals book is an excellent read as well; it explains all of this in gory detail. Note that files in /tmp are usually in a tmpfs file system. These files may be the usage of swap that you're seeing (as they will be paged out on an active system with some memory pressure) Finally, just as everyone suggests upgrading to newer postgresql releases, you probably want to get to a newer Solaris release. -- Alan ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [PERFORM] Swapping on Solaris
/tmp doesn't seem to be much of a problem. I have about 1k worth of data in there and 72k in /var/tmp. Would turning swap off help in tuning the database in this regard? top is reporting that there's 1.25GB of RAM free on a 2GB system so, in my estimation, there's no need for PostgreSQL to be swapped unless that free memory is Solaris caching files in RAM. Kevin - Original Message - From: Greg Spiegelberg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Kevin Schroeder [EMAIL PROTECTED]; pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 9:07 AM Subject: Re: [PERFORM] Swapping on Solaris Alan Stange wrote: Note that files in /tmp are usually in a tmpfs file system. These files may be the usage of swap that you're seeing (as they will be paged out on an active system with some memory pressure) You can do a couple things with /tmp. Create a separate file system for it so it will have zero impact on swap and use the noatime mount option. Alternatively, limit the size of /tmp using the mount option size=MBm replacing MB with the size you want it to be in MBytes. If your application uses /tmp heavily, be sure to put it on a speedy, local LUN. Finally, just as everyone suggests upgrading to newer postgresql releases, you probably want to get to a newer Solaris release. If you really want to avoid swapping I'd suggest tuning your database first with swap turned off and put it under a normal load while watching both top and vmstat. When you're happy with it, turn swap back on for those heavy load times and move on. Greg -- Greg Spiegelberg Product Development Manager Cranel, Incorporated. Phone: 614.318.4314 Fax: 614.431.8388 Email: [EMAIL PROTECTED] Technology. Integrity. Focus. ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [PERFORM] Swapping on Solaris
Maybe, I'm just seeing a problem where none exists. I ran sar -w 3 100 and I actually did not see any swap activity despite the fact that I've got 500+MB of swap file being used. Kevin - Original Message - From: Alan Stange [EMAIL PROTECTED] To: Kevin Schroeder [EMAIL PROTECTED] Cc: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 9:42 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: I take that back. There actually is some paging going on. I ran sar -g 5 10 and when a request was made (totally about 10 DB queries) my pgout/s jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also jumped to 121.80. I'm fairly sure that the pi and po numbers include file IO in Solaris, because of the unified VM and file systems. -- Alan ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [PERFORM] Swapping on Solaris
I may be asking the question the wrong way, but when I start up PostgreSQL swap is what gets used the most of. I've got 1282MB free RAM right now and and 515MB swap in use. Granted, swap file usage probably wouldn't be zero, but I would guess that it should be a lot lower so something must be keeping PostgreSQL from using the free RAM that my system is reporting. For example, one of my postgres processes is 201M in size but on 72M is resident in RAM. That extra 130M is available in RAM, according to top, but postgres isn't using it. Kevin - Original Message - From: Alan Stange [EMAIL PROTECTED] To: Kevin Schroeder [EMAIL PROTECTED] Cc: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 9:30 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: I suspect that the memory is being used to cache files as well since the email boxes are using unix mailboxes, for the time being. With people checking their email sometimes once per minute I can see why Solaris would want to cache those files. Perhaps my question would be more appropriate to a Solaris mailing list since what I really want to do is get Solaris to simply allow PostgreSQL to use more RAM and reduce the amount of RAM used for file caching. I would have thought that Solaris gives some deference to a running application that's being swapped than for a file cache. Is there any way to set custom parameters on Solaris' file-caching behavior to allow PostgreSQL to use more physical RAM? Your explanation doesn't sound quite correct. If postgresql malloc()'s some memory and uses it, the file cache will be reduced in size and the memory given to postgresql. But if postgresql doesn't ask for or use the memory, then solaris is going to use it for something else. There's nothing in Solaris that doesn't allow postgresql to use more RAM. -- Alan ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [PERFORM] Swapping on Solaris
I think it's probably just reserving them. I can't think of anything else. Also, when I run swap activity with sar I don't see any activity, which also points to reserved swap space, not used swap space. swap -s reports total: 358336k bytes allocated + 181144k reserved = 539480k used, 2988840k available Kevin - Original Message - From: Alan Stange [EMAIL PROTECTED] To: Kevin Schroeder [EMAIL PROTECTED] Cc: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 11:04 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: I may be asking the question the wrong way, but when I start up PostgreSQL swap is what gets used the most of. I've got 1282MB free RAM right now and and 515MB swap in use. Granted, swap file usage probably wouldn't be zero, but I would guess that it should be a lot lower so something must be keeping PostgreSQL from using the free RAM that my system is reporting. For example, one of my postgres processes is 201M in size but on 72M is resident in RAM. That extra 130M is available in RAM, according to top, but postgres isn't using it. The test you're doing doesn't measure what you think you're measuring. First, what else is running on the machine?Note that some shared memory allocations do reserve backing pages in swap, even though the pages aren't currently in use. Perhaps this is what you're measuring? swap -s has better numbers than top. You'd be better by trying a reboot then starting pgsql and seeing what memory is used. Just because you start a process and see the swap number increase doesn't mean that the new process is in swap. It means some anonymous pages had to be evicted to swap to make room for the new process or some pages had to be reserved in swap for future use. Typically a new process won't be paged out unless something else is causing enormous memory pressure... -- Alan ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PERFORM] Swapping on Solaris
Well, easy it ain't and I believe it's good. One final question: When I run sar -w I get no swap activity, but the process switch column registers between 400 and 700 switches per second. Would that be in the normal range for a medium-use system? Thanks Kevin - Original Message - From: Matt Clark [EMAIL PROTECTED] To: Kevin Schroeder [EMAIL PROTECTED] Cc: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 1:01 PM Subject: Re: [PERFORM] Swapping on Solaris This page may be of use: http://www.serverworldmagazine.com/monthly/2003/02/solaris.shtml From personal experience, for god's sake don't think Solaris' VM/swap implementation is easy - it's damn good, but it ain't easy! Matt Kevin Schroeder wrote: I think it's probably just reserving them. I can't think of anything else. Also, when I run swap activity with sar I don't see any activity, which also points to reserved swap space, not used swap space. swap -s reports total: 358336k bytes allocated + 181144k reserved = 539480k used, 2988840k available Kevin - Original Message - From: Alan Stange [EMAIL PROTECTED] To: Kevin Schroeder [EMAIL PROTECTED] Cc: pgsql-performance@postgresql.org Sent: Wednesday, January 19, 2005 11:04 AM Subject: Re: [PERFORM] Swapping on Solaris Kevin Schroeder wrote: I may be asking the question the wrong way, but when I start up PostgreSQL swap is what gets used the most of. I've got 1282MB free RAM right now and and 515MB swap in use. Granted, swap file usage probably wouldn't be zero, but I would guess that it should be a lot lower so something must be keeping PostgreSQL from using the free RAM that my system is reporting. For example, one of my postgres processes is 201M in size but on 72M is resident in RAM. That extra 130M is available in RAM, according to top, but postgres isn't using it. The test you're doing doesn't measure what you think you're measuring. First, what else is running on the machine?Note that some shared memory allocations do reserve backing pages in swap, even though the pages aren't currently in use. Perhaps this is what you're measuring? swap -s has better numbers than top. You'd be better by trying a reboot then starting pgsql and seeing what memory is used. Just because you start a process and see the swap number increase doesn't mean that the new process is in swap. It means some anonymous pages had to be evicted to swap to make room for the new process or some pages had to be reserved in swap for future use. Typically a new process won't be paged out unless something else is causing enormous memory pressure... -- Alan ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[PERFORM] Swapping on Solaris
Hello, I'm running PostgreSQL on a Solaris 8 system with 2GB of RAM and I'm having some difficulty getting PostgreSQL to use the available RAM. My RAM settings in postgresql.conf are shared_buffers = 8192 # min 16, at least max_connections*2, 8KB each sort_mem = 131072 # min 64, size in KB vacuum_mem = 131072 # min 1024, size in KB Ignoring the fact that the sort and vacuum numbers are really high, this is what Solaris shows me when running top: Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free For some reason I have 1.25GB of free RAM but PostgreSQL seems compelled to swap to the hard drive rather than use that RAM. I have the shared buffers set as high as the Solaris kernel will let me. I also know that Solaris will cache frequently used files in RAM, thereby lowering the amount of RAM available to an application, but my understanding is that Solaris will dump that cache if an application or the kernel itself requires it. The system has about 1,000 active email users using unix mailboxes which could what is keeping the database from exploiting as much RAM as available but my primary concern is to allow PostgreSQL to use as much RAM as it requires without swapping. What can I do to force the system to allow PostgreSQL to do this? Regards, Kevin Schroeder ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PERFORM] PostgreSQL vs. MySQL
My goodness people!! If you are just going to bash people who are trying to learn PostgreSQL then you have no chance of ever getting new people using it! Cut out this crap and do what this list is meant to do, which is, I'm assuming, helping people figure out why their installations aren't running as fast as they would like. This is pathetic!! Kevin - Original Message - From: Bjoern Metzdorf [EMAIL PROTECTED] To: Postgresql Performance [EMAIL PROTECTED] Sent: Friday, July 04, 2003 11:22 AM Subject: Re: [PERFORM] PostgreSQL vs. MySQL I'm not saying (and never did say) that postgres could not be fast. All I ever said was that with the same minimal effort applied to both DBs, postgres was slower. Afaik, your original posting said postgresql was 3 times slower than mysql and that you are going to leave this list now. This implied that you have made your decision between postgresql and mysql, taking mysql because it is faster. Now you say your testing setup has minimal effort applied. Well, it is not very surprising that mysql is faster in standard configurations. As Shridhar pointed out, postgresql has very conservative default values, so that it starts on nearly every machine. If I was your client and gave you the task to choose a suitable database for my application and you evaluated suitable databases this way, then something is seriously wrong with your work. Regards, Bjoern ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org