<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
h5
        {mso-style-priority:9;
        mso-style-link:"\00DCberschrift 5 Zchn";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Times New Roman","serif";
        font-weight:bold;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;
        mso-fareast-language:DE-AT;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.E-MailFormatvorlage20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.berschrift5Zchn
        {mso-style-name:"\00DCberschrift 5 Zchn";
        mso-style-priority:9;
        mso-style-link:"\00DCberschrift 5";
        font-family:"Cambria","serif";
        color:#243F60;}
span.E-MailFormatvorlage23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE-AT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Nicolas,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>thanks for your reply.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I checked the index and this wasn’t the problem. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gerald<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> spacewalk-list-bounces@redhat.com [mailto:spacewalk-list-bounces@redhat.com] <b>Im Auftrag von </b>pradelles nicolas<br><b>Gesendet:</b> Freitag, 23. September 2011 10:56<br><b>An:</b> spacewalk-list@redhat.com<br><b>Betreff:</b> Re: [Spacewalk-list] Optimizing postgresql with Spacewalk 1.5 onCentOS 6.0 x86_64<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hello,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>please check my thread "Repo Sync speed problem" the 16/08/2011, I had the same problem on a Oracle database. An index was not created during installation, and reposync was slower and slower.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>After added the index everything returned to normal.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>The SQL part: </span><o:p></o:p></p><p><span lang=EN-US><a href="http://git.fedorahosted.org/git/?p=spacewalk.git;a=blob;f=schema/spacewalk/common/tables/rhnPackageCapability.sql#l32"><span lang=EN style='font-size:10.0pt'>http://git.fedorahosted.org/git/?p=spacewalk.git;a=blob;f=schema/spacewalk/common/tables/rhnPackageCapability.sql#l32</span></a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Regards,</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Nicolas</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span lang=EN-US><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> spacewalk-list-bounces@redhat.com [mailto:spacewalk-list-bounces@redhat.com] <b>On Behalf Of </b>Gerald<br><b>Sent:</b> vendredi 23 septembre 2011 10:30<br><b>To:</b> spacewalk-list@redhat.com<br><b>Subject:</b> Re: [Spacewalk-list] Optimizing postgresql with Spacewalk 1.5 onCentOS 6.0 x86_64</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’m now syncing for TWO AND A HALF WEEK (spacewalk-repo-sync for centos5+6 repos) <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>and still not finished (spacewalk 1.5 with postgresql, centos5 x86_64).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Especially the larger repos from rpmforge are a massive problem.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>With oracle guess I synced all in max. 2 days.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’ve tried the performance settings from below, tried others, added more ram, etc. but it still takes ages <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>(at the moment I’m syncing package 6200 of 8215 and it takes 61sec per package! In the beginning it’s a bit faster and then<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>it gets slower and slower).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Disabling taskomatic and osa-dispatcher didn’t help either. Maybe there are some other suggestions to try?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hope someone can speed up this process…<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you guys,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gerald<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> spacewalk-list-bounces@redhat.com [mailto:spacewalk-list-bounces@redhat.com] <b>Im Auftrag von </b>Pierre Casenove<br><b>Gesendet:</b> Mittwoch, 14. September 2011 20:37<br><b>An:</b> spacewalk-list@redhat.com<br><b>Betreff:</b> Re: [Spacewalk-list] Optimizing postgresql with Spacewalk 1.5 on CentOS 6.0 x86_64<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks for sharing your experience. I don't experience problem so I think I'll keep with the default params.<o:p></o:p></p><div><p class=MsoNormal>Could someone from spacewalk team confirm the optimization possibilities?<o:p></o:p></p></div><div><p class=MsoNormal>Another point about the autovacuum function: BZ 705935 address the fact that vacuum is useless. Is it still a valid BZ?<o:p></o:p></p></div><div><pre><span style='font-size:13.5pt;background:white'><o:p> </o:p></span></pre><pre><span style='font-size:13.5pt;background:white'>Description of problem:<o:p></o:p></span></pre><pre><span style='font-size:13.5pt;background:white'>Seems like Spacewalk is keeping database transactions open which leads to<o:p></o:p></span></pre><pre><span style='font-size:13.5pt;background:white'>unremovable dead rows in tables.<o:p></o:p></span></pre></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Pierre<o:p></o:p></p><div><p class=MsoNormal>2011/9/14 Scott Worthington <<a href="mailto:scott.c.worthington@gmail.com">scott.c.worthington@gmail.com</a>><o:p></o:p></p><p class=MsoNormal>Hello,<br><br>I'd like to share my experience with out-of-the-box installation of<br>Spacewalk 1.5 on CentOS 6.0 x86_64.<br><br>The out-of-the-box default configuration of postgresql is abysmal.<br>You may be very familiar with MySQL, but postgresql is certainly not<br>MySQL (install and forget). You _HAVE_ to make configuration changes<br>and tune postgresql for optimum performance with Spacewalk.<br><br>While reading this, please note that this is for the CentOS 6.0 x86_64<br>platform.  I cannot speak for Ubuntu, Debian, or other CentOS<br>releases, etc.<br><br>In my installation, I am using 4GB of server RAM as a virtualized<br>guest on VMware.  I have NOT changed Java or Tomcat's memory heap<br>settings (-Xms or -Xmx) and I don't believe it is necessary.  Your<br>slowness is due to postgresql.<br><br>* Before making the following changes, shutdown Spacewalk and then<br>Postgresql.  Better yet, run Spacewalk on VMware and take a snapshot<br>of your current setup for rollbacks (if you're like me, you've spent<br>hours upon hours loading in Channels and their repo data).<br><br>spacewalk-service stop<br>service postgresql stop<br><br>== Default postgresql configuration ==<br><br>Auto vacuum is NOT enabled.  This causes the database server to crawl<br>to a halt during the loading of thousands of RPMs via the "rhnpush"<br>CLI and also through "spacewalk-repo-syncs --type yum".<br><br>* Turn on autovacuum<br><br>Edit your /var/lib/pgsql/data/postgresql.conf and find...<br><br>#autovacuum=on<br><br>...and uncomment it:<br><br>autovacuum=on<br><br>In the same file, find...<br><br>#track_counts = on<br><br>...and uncomment it:<br><br>track_counts = on<br><br>== Install pgtune ==<br><br>Next, tune postgresql using the pgtune package. I have found that the<br>package pgtune is excellent for tuning your system.  The following<br>instructions have you download the .tar.gz file and create an<br>installable RPM.  I prefer install RPMs, not source.  You can install<br>source, that is your prerogative.<br><br>* Download and compile pgtune (to install it as an RPM):<br><br>* First, ensure you have rpmbuild installed<br><br>yum install rpmbuild<br><br># next, download, put files in the correct directories, and build<br>mkdir -p /usr/local/src/TARGZs/pgtune<br>cd /usr/local/src/TARGZs/pgtune<br>wget <a href="http://pgfoundry.org/frs/download.php/2449/pgtune-0.9.3.tar.gz" target="_blank">http://pgfoundry.org/frs/download.php/2449/pgtune-0.9.3.tar.gz</a><br>tar xvfz pgtune-0.9.3.tar.gz<br>cp /usr/local/src/TARGZs/pgtune/pgtune-0.9.3.tar.gz /root/rpmbuild/SOURCES<br>cp /usr/local/src/TARGZs/pgtune/pgtune-0.9.3/pgtune.spec /root/rpmbuild/SPECS<br>cp /usr/local/src/TARGZs/pgtune/pgtune-0.9.3/pgtune-settingsdir.patch<br>/root/rpmbuild/SOURCES<br>cd /root/rpmbuild/SPECS<br>#the spec file has an incorrect version number, the following command<br>will fix it<br>perl -npe 's/0\.9\.2/0.9.3/g' -i /root/rpmbuild/SPECS/pgtune.spec<br>rpmbuild -ba pgtune.spec<br>#If your rpmbuild fails, you may need to install dependencies, look at<br>the output of the rpmbuild<br><br>#install the RPM<br>rpm -ivh /root/rpmbuild/RPMS/noarch/pgtune-0.9.3-1.el6.noarch.rpm<br><br>After pgtune is installed, run it on your postgresql.conf file:<br><br>cd /var/lib/pgsql/data<br>pgtune -i postgresql.conf -o postgresql.conf.pgtune<br><br>* Make a backup of your existing, "working" configuration (replace<br>YYYYMMDD with today's date)<br><br>cp -p postgresql.conf postgresql.conf-working-YYYYMMDD<br><br>* Replace existing config<br><br>cp postgresql.conf.pgtune postgresql.conf<br><br>* I do not believe that the postgresql.conf file contains the<br>"default" parameters in the lines that are commented out (unlike<br>packages like postfix).  I recommend that you do not trust the<br>postgresql.conf default file as a source of "default" parameters.<br><br>* I have also edited by hand and uncommented the entire AUTOVACUUM<br>PARAMETERS section and increased the autovacuum_max_workers from 3 to<br>5:<br><br>#------------------------------------------------------------------------------<br># AUTOVACUUM PARAMETERS<br>#------------------------------------------------------------------------------<br><br>autovacuum = on                 # Enable autovacuum subprocess?  'on'<br>                                       # requires track_counts to also be on.<br>#log_autovacuum_min_duration = -1       # -1 disables, 0 logs all actions and<br>                                       # their durations, > 0 logs only<br>                                       # actions running at least this number<br>                                       # of milliseconds.<br>autovacuum_max_workers = 5              # max number of autovacuum subprocesses<br>autovacuum_naptime = 1min               # time between autovacuum runs<br>autovacuum_vacuum_threshold = 50        # min number of row updates before<br>                                       # vacuum<br>autovacuum_analyze_threshold = 50       # min number of row updates before<br>                                       # analyze<br>autovacuum_vacuum_scale_factor = 0.2    # fraction of table size before vacuum<br>autovacuum_analyze_scale_factor = 0.1   # fraction of table size before analyze<br>autovacuum_freeze_max_age = 200000000   # maximum XID age before forced vacuum<br>                                       # (change requires restart)<br>autovacuum_vacuum_cost_delay = 20ms     # default vacuum cost delay for<br>                                       # autovacuum, in milliseconds;<br>                                       # -1 means use vacuum_cost_delay<br>autovacuum_vacuum_cost_limit = -1       # default vacuum cost limit for<br>                                       # autovacuum, -1 means use<br>                                       # vacuum_cost_limit<br><br>* After you have made the above changes, attempt to restart postgresql<br>(it will most likely fail)<br><br>service postgresql restart<br><br>* Yes, it will FAIL. Why did it fail?  Most likely postgresql needs<br>more memory now and the default kernel memory setup is too low<br>(Hopefully you didn't introduce a typo)<br><br>* Examine the contents of postgresql's startup log:<br><br>less /var/lib/pgsql/pgstartup.log<br><br>* You may see something like this at the end:<br><br>FATAL:  could not create shared memory segment: Invalid argument<br>DETAIL:  Failed system call was shmget(key=5432001, size=1040752640, 03600).<br>HINT:  This error usually means that PostgreSQL's request for a shared<br>memory segment exceeded your kernel's SHMMAX parameter.  You can<br>either reduce the request size or reconfigure the kernel with larger<br>SHMMAX.  To reduce the request size (currently 1040752640 bytes),<br>reduce PostgreSQL's shared_buffers parameter (currently 122880) and/or<br>its max_connections parameter (currently 85).<br>       If the request size is already small, it's possible that it is<br>less than your kernel's SHMMIN parameter, in which case raising the<br>request size or reconfiguring SHMMIN is called for.<br>       The PostgreSQL documentation contains more information about<br>shared memory configuration.<br><br>* You have to bump up your Linux kernel.shmmax to the number, in the<br>example above, the number is "1040752640"<br><br>* First, non-persistently:<br><br>sysctl -w kernel.shmmax=1040752640<br><br>* Try to restart postgresql<br><br>service postgresql restart<br><br>* If it fails, look again inside of /var/lib/pgsql/pgstartup.log and<br>see if you made a mistake with the shmmax number and fix your<br>kernel.shmmax<br><br>* Finally, make the number that you ended up using for kernel.shmmax<br>and make it persistent between boots:<br>cat >> /etc/sysctl.conf << 'END_OF_FILE'<br>#YYYY-MM-DD HHMM (your-initials)<br>kernel.shmmax=1040752640<br>END_OF_FILE<br><br>I have found that making those changes above makes postgresql and<br>Spacewalk usable and much much faster.  I have not experienced the<br>"500 server timeout" error since.<br><br>If you are having problems with loading packages into your Spacewalk,<br>running top will usually show postgresql is sitting on a "DELETE" or<br>other process that is taking forever -- the above may help speed up<br>your postgresql.<br><br>I hope you have the best of luck with your Spacewalk & postgresql<br>deployment on CentOS 6.0 x86_64, and I hope the above instructions may<br>benefit you.<br><br>_______________________________________________<br>Spacewalk-list mailing list<br><a href="mailto:Spacewalk-list@redhat.com">Spacewalk-list@redhat.com</a><br><a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" target="_blank">https://www.redhat.com/mailman/listinfo/spacewalk-list</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div><h5><span style='color:black'><o:p> </o:p></span></h5><h5 align=center style='text-align:center'><span style='color:black'><hr size=2 width="100%" align=center></span></h5><h5><span style='color:black'>This message may contain confidential or privileged information and is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not one of the intended recipients of this message you are hereby notified that any review, dissemination, distribution or copying is strictly prohibited. This communication is for information purposes only and should not be regarded as an official statement of Eutelsat S.A. or any of its subsidiaries. E-mail transmission cannot be guaranteed to be secure or error-free. Therefore, Eutelsat S.A. does not claim that this information is complete or accurate and it should not be treated as such. <o:p></o:p></span></h5><h5 align=center style='text-align:center'><span style='color:black'><hr size=2 width="100%" align=center></span></h5></div></body></html>