[Re] Need help with postgresql/apache/php optimisation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Froggy / Froggy Corp.

    [Re] Need help with postgresql/apache/php optimisation

    Thx for your quick answer too :)

    Richard Huxton wrote:[color=blue]
    >
    > On Wednesday 18 February 2004 20:18, Froggy / Froggy Corp. wrote:[color=green]
    > > Hello,
    > >
    > > I asked one time for more "benchmark" soft to know where is the cpu
    > > average, and read the post about optimising the postgresql.conf (and use
    > > them), but i allways get a load > 1 on fire time (dunno the right name,
    > > "coup de feu" in french (10h00 -> 14h00, 18h00 -> 21h00).[/color]
    >
    > This is the period when you get the most hits, yes?[/color]

    yes
    [color=blue][color=green]
    > > With different software, i dont see anything wrong (or i dont understand
    > > how to use them), the problem is the memory which make some nice road
    > > around 12Mo Free and 3Mo Free, but the swap dont really grow up (but
    > > linux make a lot of cache).[/color]
    >
    > Not sure I understand you fully, but if swap isn't active you should be OK.
    > See below for a good test.[/color]

    Swap is active, but the size don't change a lot. (12Mb common time,
    maybe 50Mb on rush time).
    [color=blue]
    > There are three things to look at while testing this:
    > 1. The output of "vmstat 1" - this will show memory usage, swap activity disk
    > blocks in/out, cpu usage etc.
    > 2. The output from "top", press "M" to sort by memory usage - that way we can
    > see how much memory is being used.
    > 3. How many requests are you processing at the same time?[/color]

    I will use vmstat 1 tomorrow (22:24 here, so too late)

    Around 4/5 postgresql thread and around 20 apache thread with top.
    With mod-status from apache, i get same information, 20 requests in
    process, but only some in activity.
    [color=blue][color=green]
    > > If someone could help me, i need to put a new feature which will add
    > > more than 2000 hit per day and im afraid about the life of the server[/color]
    >
    > Only 5000 hits per day? I'm sure we can get that working.[/color]

    I hope :D.

    Another question, i put on postgresql.conf a limited number of
    postgresql max_connections , and use permanent link beetween apache and
    postgresql. The problem is that a lot of apache thread is used for
    sending data (gfx). Is there a way to say that some thread are only here
    for php process ?

    thx in advance,
    regards,

    ---------------------------(end of broadcast)---------------------------
    TIP 8: explain analyze is your friend

  • scott.marlowe

    #2
    Re: [Re] Need help with postgresql/apache/php optimisation

    On Wed, 18 Feb 2004, Froggy / Froggy Corp. wrote:
    [color=blue]
    > Another question, i put on postgresql.conf a limited number of
    > postgresql max_connections , and use permanent link beetween apache and
    > postgresql. The problem is that a lot of apache thread is used for
    > sending data (gfx). Is there a way to say that some thread are only here
    > for php process ?[/color]

    No, PHP's "connection pooling" is more of an accident looking for a place
    to happen than useful sometimes. you might want to try reverting to just
    plain pg_connects and see how the machine behaves.


    ---------------------------(end of broadcast)---------------------------
    TIP 8: explain analyze is your friend

    Comment

    • Froggy / Froggy Corp.

      #3
      Re: [Re] Need help with postgresql/apache/php optimisation

      In fact, under php4.?, the connexion is not save under session, so i
      allways need to make a pg_connect. But under documentation it say that
      the socket stay open, so i save some cpu.

      "scott.marl owe" wrote:[color=blue]
      >
      > On Wed, 18 Feb 2004, Froggy / Froggy Corp. wrote:
      >[color=green]
      > > Another question, i put on postgresql.conf a limited number of
      > > postgresql max_connections , and use permanent link beetween apache and
      > > postgresql. The problem is that a lot of apache thread is used for
      > > sending data (gfx). Is there a way to say that some thread are only here
      > > for php process ?[/color]
      >
      > No, PHP's "connection pooling" is more of an accident looking for a place
      > to happen than useful sometimes. you might want to try reverting to just
      > plain pg_connects and see how the machine behaves.[/color]

      ---------------------------(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

      Comment

      • Richard Huxton

        #4
        Re: [Re] Need help with postgresql/apache/php optimisation

        On Wednesday 18 February 2004 21:35, Froggy / Froggy Corp. wrote:[color=blue]
        >
        > Another question, i put on postgresql.conf a limited number of
        > postgresql max_connections , and use permanent link beetween apache and
        > postgresql. The problem is that a lot of apache thread is used for
        > sending data (gfx). Is there a way to say that some thread are only here
        > for php process ?[/color]

        Given your lack of memory, I'd drop the permanent (persistent) connections
        between php and postgresql - connect for every page you need to. That should
        free up some memory.

        Once we have the vmstat figures, we can look at how to tune postgresql.conf
        --
        Richard Huxton
        Archonet Ltd

        ---------------------------(end of broadcast)---------------------------
        TIP 5: Have you checked our extensive FAQ?



        Comment

        Working...