Hilfe mit Apache Setup und Crosslinked DB-Server

Apache, Lighttpd, nginx, Cherokee
stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-01 10:39

Hallo,
ich habe kürzlich meine Seite (ein Forum) auf 2 Corssgelinkte Server verlagert, auf den einem Server der Apache und auf dem anderen Server die MySQL Datenbank.

So weit läuft das auch ganz gut, nur abends wenn die meisten Leute online sind hängt sich der Apache-Server von zeit zu zeit auf. Der load geht auf 700+ und die Tasks im top auf bis zu 3000+ (max Serverwert).
Ein einfacher Apache Restart reicht meistens aus um den Server wieder in gang zu bringen.

In den Connections habe ich gesehen, dass bis zu 12000 Verbindungen von dem MySQL-Server zurückkommen (wenn der Server #1 hängt), im normalen Betrieb sind das doch nur einige wenige.

Wie kommt dieser Überlauf den Apachen zustande? Eine Fehlkonfiguration des Apachen oder eher des MySQL Servers? Letzter hat im übrigen nie ein Problem und läuft stabil.

Beide Server sind Dual QuadCores mit 8 GB speicher und SATA HDs, auf Debian 4.

bin für jede Hilfe äusserst Dankbar!

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by Joe User » 2008-11-01 16:19

Dein Apache ist suboptimal konfiguriert: http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-01 17:05

selbst geschrieben was? die software? nein, ist ein ipb-forum.
die mysql connections werden ja im laufenden betrieb wieder geschlossen (hab's auch mal über pconnect versucht, mit dem selben ergebnis), nur hin und wieder häufen sich die Verbindungen bis zum Absturz.)
Meiner Meinung nach ist der Apache richtig konfiguriert, hier aber mal die config, vielleicht hab ich ja was übersehen?!

mittlerweile habe ich die apache Config verändert, die ehemalige config-Datei sah so aus:

Code: Select all

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.1/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned. 
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#<IfModule !mpm_winnt.c>
#<IfModule !mpm_netware.c>
LockFile /var/lock/apache2/accept.lock
#</IfModule>
#</IfModule>

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /var/run/apache2.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 100

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 3000

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 3
ServerLimit 3100
##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          10
    MinSpareServers       10
    MaxSpareServers      30
    MaxClients          3000
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

User www-data
Group www-data

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig /etc/mime.types

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

# Include generic snippets of statements
Include /etc/apache2/conf.d/

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of:  Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Full

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature On

<IfModule alias_module>
    #
    # Aliases: Add here as many aliases as you need (with no limit). The format is
    # Alias fakename realname
    #
    # Note that if you include a trailing / on fakename then the server will
    # require it to be present in the URL.  So "/icons" isn't aliased in this
    # example, only "/icons/".  If the fakename is slash-terminated, then the
    # realname must also be slash terminated, and if the fakename omits the
    # trailing slash, the realname must also omit it.
    #
    # We include the /icons/ alias for FancyIndexed directory listings.  If
    # you do not use FancyIndexing, you may comment this out.
    #
    Alias /icons/ "/usr/share/apache2/icons/"

    <Directory "/usr/share/apache2/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

</IfModule>

#
# Directives controlling the display of server-generated directory listings.
#
<IfModule mod_autoindex.c>

    #
    # IndexOptions: Controls the appearance of server-generated directory
    # listings.
    #
    IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=*

    #
    # AddIcon* directives tell the server which icon to show for different
    # files or filename extensions.  These are only displayed for
    # FancyIndexed directories.
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^

    #
    # DefaultIcon is which icon to show for files which do not have an icon
    # explicitly set.
    #
    DefaultIcon /icons/unknown.gif

    #
    # AddDescription allows you to place a short description after a file in
    # server-generated indexes.  These are only displayed for FancyIndexed
    # directories.
    # Format: AddDescription "description" filename
    #
    #AddDescription "GZIP compressed document" .gz
    #AddDescription "tar archive" .tar
    #AddDescription "GZIP compressed tar archive" .tgz

    #
    # ReadmeName is the name of the README file the server will look for by
    # default, and append to directory listings.
    #
    # HeaderName is the name of a file which should be prepended to
    # directory indexes.
    ReadmeName README.html
    HeaderName HEADER.html

    #
    # IndexIgnore is a set of filenames which directory indexing should ignore
    # and not include in the listing.  Shell-style wildcarding is permitted.
    #
    IndexIgnore .??* *~ *# RCS CVS *,v *,t
</IfModule>

<IfModule mod_mime.c>

    #
    # AddType allows you to add to or override the MIME configuration
    # file mime.types for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    # Despite the name similarity, the following Add* directives have
    # nothing to do with the FancyIndexing customization directives above.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # DefaultLanguage and AddLanguage allows you to specify the language of
    # a document. You can then use content negotiation to give a browser a
    # file in a language the user can understand.
    #
    # Specify a default language. This means that all data
    # going out without a specific language tag (see below) will
    # be marked with this one. You probably do NOT want to set
    # this unless you are sure it is correct for all cases.
    #
    # * It is generally better to not mark a page as
    # * being a certain language than marking it with the wrong
    # * language!
    #
    # DefaultLanguage nl
    #
    # Note 1: The suffix does not have to be the same as the language
    # keyword --- those with documents in Polish (whose net-standard
    # language code is pl) may wish to use "AddLanguage pl .po" to
    # avoid the ambiguity with the common suffix for perl scripts.
    #
    # Note 2: The example entries below illustrate that in some cases
    # the two character 'Language' abbreviation is not identical to
    # the two character 'Country' code for its country,
    # E.g. 'Danmark/dk' versus 'Danish/da'.
    #
    # Note 3: In the case of 'ltz' we violate the RFC by using a three char
    # specifier. There is 'work in progress' to fix this and get
    # the reference data for rfc1766 cleaned up.
    #
    # Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
    # English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
    # Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
    # Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
    # Norwegian (no) - Polish (pl) - Portugese (pt)
    # Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
    # Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
    #
    AddLanguage ca .ca
    AddLanguage cs .cz .cs
    AddLanguage da .dk
    AddLanguage de .de
    AddLanguage el .el
    AddLanguage en .en
    AddLanguage eo .eo
    AddLanguage es .es
    AddLanguage et .et
    AddLanguage fr .fr
    AddLanguage he .he
    AddLanguage hr .hr
    AddLanguage it .it
    AddLanguage ja .ja
    AddLanguage ko .ko
    AddLanguage ltz .ltz
    AddLanguage nl .nl
    AddLanguage nn .nn
    AddLanguage no .no
    AddLanguage pl .po
    AddLanguage pt .pt
    AddLanguage pt-BR .pt-br
    AddLanguage ru .ru
    AddLanguage sv .sv
    AddLanguage zh-CN .zh-cn
    AddLanguage zh-TW .zh-tw
</IfModule>

<IfModule mod_negotiation.c>
    #
    # LanguagePriority allows you to give precedence to some languages
    # in case of a tie during content negotiation.
    #
    # Just list the languages in decreasing order of preference. We have
    # more or less alphabetized them here. You probably want to change this.
    #
    LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

    #
    # ForceLanguagePriority allows you to serve a result page rather than
    # MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
    # [in case no accepted languages matched the available variants]
    #
    ForceLanguagePriority Prefer Fallback

</IfModule>

<IfModule mod_mime.c>
    #
    # Specify a default charset for all pages sent out. This is
    # always a good idea and opens the door for future internationalisation
    # of your web site, should you ever want it. Specifying it as
    # a default does little harm; as the standard dictates that a page
    # is in iso-8859-1 (latin1) unless specified otherwise i.e. you
    # are merely stating the obvious. There are also some security
    # reasons in browsers, related to javascript and URL parsing
    # which encourage you to always set a default char set.
    #
    #AddDefaultCharset ISO-8859-1

    #
    # Commonly used filename extensions to character sets. You probably
    # want to avoid clashes with the language extensions, unless you
    # are good at carefully testing your setup after each change.
    # See http://www.iana.org/assignments/character-sets for the
    # official list of charset names and their respective RFCs.
    #
    AddCharset us-ascii    .ascii .us-ascii
    AddCharset ISO-8859-1  .iso8859-1  .latin1
    AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
    AddCharset ISO-8859-3  .iso8859-3  .latin3
    AddCharset ISO-8859-4  .iso8859-4  .latin4
    AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
    AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
    AddCharset ISO-8859-7  .iso8859-7  .grk .greek
    AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
    AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
    AddCharset ISO-8859-10  .iso8859-10  .latin6
    AddCharset ISO-8859-13  .iso8859-13
    AddCharset ISO-8859-14  .iso8859-14  .latin8
    AddCharset ISO-8859-15  .iso8859-15  .latin9
    AddCharset ISO-8859-16  .iso8859-16  .latin10
    AddCharset ISO-2022-JP .iso2022-jp .jis
    AddCharset ISO-2022-KR .iso2022-kr .kis
    AddCharset ISO-2022-CN .iso2022-cn .cis
    AddCharset Big5        .Big5       .big5 .b5
    AddCharset cn-Big5     .cn-big5
    # For russian, more than one charset is used (depends on client, mostly):
    AddCharset WINDOWS-1251 .cp-1251   .win-1251
    AddCharset CP866       .cp866
    AddCharset KOI8      .koi8
    AddCharset KOI8-E      .koi8-e
    AddCharset KOI8-r      .koi8-r .koi8-ru
    AddCharset KOI8-U      .koi8-u
    AddCharset KOI8-ru     .koi8-uk .ua
    AddCharset ISO-10646-UCS-2 .ucs2
    AddCharset ISO-10646-UCS-4 .ucs4
    AddCharset UTF-7       .utf7
    AddCharset UTF-8       .utf8
    AddCharset UTF-16      .utf16
    AddCharset UTF-16BE    .utf16be
    AddCharset UTF-16LE    .utf16le
    AddCharset UTF-32      .utf32
    AddCharset UTF-32BE    .utf32be
    AddCharset UTF-32LE    .utf32le
    AddCharset euc-cn      .euc-cn
    AddCharset euc-gb      .euc-gb
    AddCharset euc-jp      .euc-jp
    AddCharset euc-kr      .euc-kr
    #Not sure how euc-tw got in - IANA doesn't list it???
    AddCharset EUC-TW      .euc-tw
    AddCharset gb2312      .gb2312 .gb
    AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
    AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
    AddCharset shift_jis   .shift_jis .sjis

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    #
    # For files that include their own HTTP headers:
    #
    #AddHandler send-as-is asis

    #
    # For server-parsed imagemap files:
    #
    #AddHandler imap-file map

    #
    # For type maps (negotiated resources):
    # (This is enabled by default to allow the Apache "It Worked" page
    #  to be distributed in multiple languages.)
    #
    AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_<error>.html.var response to
# our collection of by-error message multi-language collections.  We use
# includes to substitute the appropriate text.
#
# You can modify the messages' appearance without changing any of the
# default HTTP_<error>.html.var files by adding the line:
#
#   Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /usr/share/apache2/error/include/ files and copying them to /your/include/path/,
# even on a per-VirtualHost basis.  The default include files will display
# your Apache version number and your ServerAdmin email address regardless
# of the setting of ServerSignature.
#
# The internationalized error documents require mod_alias, mod_include
# and mod_negotiation.  To activate them, uncomment the following 30 lines.

#    Alias /error/ "/usr/share/apache2/error/"
#
#    <Directory "/usr/share/apache2/error">
#        AllowOverride None
#        Options IncludesNoExec
#        AddOutputFilter Includes html
#        AddHandler type-map var
#        Order allow,deny
#        Allow from all
#        LanguagePriority en cs de es fr it nl sv pt-br ro
#        ForceLanguagePriority Prefer Fallback
#    </Directory>
#
#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
#    ErrorDocument 410 /error/HTTP_GONE.html.var
#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

<IfModule mod_setenvif.c>
    #
    # The following directives modify normal HTTP response behavior to
    # handle known problems with browser implementations.
    #
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4.0" force-response-1.0
    BrowserMatch "Java/1.0" force-response-1.0
    BrowserMatch "JDK/1.0" force-response-1.0

    #
    # The following directive disables redirects on non-GET requests for
    # a directory that does not include the trailing slash.  This fixes a
    # problem with Microsoft WebFolders which does not appropriately handle
    # redirects for folders with DAV methods.
    # Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
    #
    BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
    BrowserMatch "MS FrontPage" redirect-carefully
    BrowserMatch "^WebDrive" redirect-carefully
    BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
    BrowserMatch "^gnome-vfs/1.0" redirect-carefully
    BrowserMatch "^XML Spy" redirect-carefully
    BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
</IfModule>

#<IfModule mod_status.c>
    #
    # Allow server status reports generated by mod_status,
    # with the URL of http://servername/server-status
    # Change the ".example.com" to match your domain to enable.
    #
    #<Location /server-status>
    #    SetHandler server-status
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #</Location>
#</IfModule>

#<IfModule mod_info.c>
    #
    # Allow remote server configuration reports, with the URL of
    #  http://servername/server-info (requires that mod_info.c be loaded).
    # Change the ".example.com" to match your domain to enable.
    #
    #<Location /server-info>
    #    SetHandler server-info
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #</Location>
#</IfModule>

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by Joe User » 2008-11-01 17:41

Folgendes bitte ändern:

Code: Select all

Timeout 300
KeepAlive Off
KeepAliveTimeout 3
MaxKeepAliveRequests 100
#ServerLimit 3100
<IfModule mpm_prefork_module>
   StartServers          10
   MinSpareServers       10
   MaxSpareServers       30
   MaxClients          3000
   MaxRequestsPerChild  500
</IfModule>
<IfModule mpm_worker_module>
   StartServers           2
   MaxClients           150
   MinSpareThreads       25
   MaxSpareThreads       75
   ThreadsPerChild       25
   MaxRequestsPerChild  500
</IfModule>
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

oxygen
RSAC
Posts: 2179
Joined: 2002-12-15 00:10
Location: Bergheim

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by oxygen » 2008-11-02 11:31

Da ist die Orginial Konfiguration aber passender.
KeepAlive muss auf jeden Fall an bleiben. Sonst entsteht ein hoher Overhead
MaxRequestsPerChild auf 500 ist Unsinn. Wenn man es schon aktiviert, dann auf eine hohe Zahl z.B. 5000 oder 10000. Ansonsten ist der Apache die ganze Zeit damit beschäftigt neue Prozesse zu spawnen was einen starken Overhead produziert.
Timeout / KeepAliveTimeout sollte niedrig angesetzt werden, damit die Verbindungen nicht zu lange offen bleiben und damit Worker Threads blockieren.

Meine Empfehlung wäre:

Code: Select all

Timeout 3
KeepAlive On
KeepAliveTimeout 3
MaxKeepAliveRequests 0
<IfModule mpm_worker_module>
ServerLimit  600
StartServers           20
MaxClients           3000
MinSpareThreads       25
MaxSpareThreads       100
ThreadsPerChild       50
MaxRequestsPerChild  20000
</IfModule>


vgl. dazu auch
http://httpd.apache.org/docs/2.2/mod/worker.html
http://httpd.apache.org/docs/2.2/mod/

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-02 11:53

Danke erstmal an alle die sich damit befassen.

Joe User, #ServerLimit 3100 kann ich nicht angeben da er sonst beim starten meckert und den default-wert von 256 als Limit einsetzt.
Allerdings benutze ich seit gestern deinen Vorschlag und er hat sich noch nicht aufgehangen bis jetzt. Nun ist am Wochenende auch weniger los, ab Montag gehts wieder rund und es wird sich zeigen ob der Apache stabil läuft.

oxygen, ist 600 als Serverlimit nicht sehr wenig? Ein Dual-Quad server mit 16 GB Ram (der Apache-Server hat 16 GB, nicht 8 wie oben angebeben) kann doch sicherlich mehr bewältigen?
Das mit dem Timeouts leuchtet ein, ich werde die noch ein wenig herabsetzen.
Wenn er das nächste mal wieder hängt nehme ich deine Konfig :-)

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by Joe User » 2008-11-02 12:09

oxygen wrote:Da ist die Orginial Konfiguration aber passender.

http://www.devside.net/articles/apache- ... nce-tuning
BTW: Er nutzt mpm-prefork nicht mpm-worker...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

oxygen
RSAC
Posts: 2179
Joined: 2002-12-15 00:10
Location: Bergheim

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by oxygen » 2008-11-02 12:12

stamos wrote:oxygen, ist 600 als Serverlimit nicht sehr wenig? Ein Dual-Quad server mit 16 GB Ram (der Apache-Server hat 16 GB, nicht 8 wie oben angebeben) kann doch sicherlich mehr bewältigen?

ServerLimit ist die Anzahl der Prozesse. Jedoch spawnt der Apache pro Prozess noch weitere Threads (zumindest mit mpm_worker). MaxClients 3000 / ThreadsPerChild 50 = 600 Prozesse.

Sollte tatsächlich mpm-prefork aktiv sein, wäre das schlecht. Dann einfach per apt-get install apache2-mpm-worker auf worker ändern. Kannst du mit apache2 -l rausfinden. btw: In dem Fall wäre es tatsächlich richtig KeepAlive abzuschalten.
Last edited by oxygen on 2008-11-02 12:28, edited 1 time in total.

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by Joe User » 2008-11-02 12:26

oxygen wrote:Sollte tatsächlich mpm-prefork aktiv sein, wäre das schlecht.

Sieht man schon an seinen Änderungen an der Config, betrifft alles mpm-prefork...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-02 19:32

tatsächlich hat er sich jetzt wieder augehangen, hier das top:

Code: Select all

top - 19:26:26 up 12 days, 10:38,  1 user,  load average: 824.23, 973.01, 815.36
Tasks: 3145 total,   3 running, 3142 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.5%us, 15.3%sy,  0.0%ni, 83.4%id,  0.4%wa,  0.1%hi,  0.3%si,  0.0%st
Mem:  16630960k total, 12073064k used,  4557896k free,    94252k buffers
Swap:  1028148k total,        0k used,  1028148k free,  5569540k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
31328 root      16   0  4108 2940  852 R    2  0.0   0:00.47 top               
26815 www-data  15   0 99.9m 9980 5396 D    0  0.1   0:00.51 apache2           
29369 www-data  15   0 99.8m 8716 4408 D    0  0.1   0:00.35 apache2           
19896 www-data  15   0  102m  16m 9.8m D    0  0.1   0:01.78 apache2           
20048 www-data  16   0  101m  11m 6324 S    0  0.1   0:02.32 apache2           
21393 www-data  15   0 99.9m  10m 6032 D    0  0.1   0:01.05 apache2           
21597 www-data  16   0 99.9m  10m 6132 S    0  0.1   0:01.05 apache2           
23523 www-data  15   0 99.9m  11m 7644 D    0  0.1   0:00.82 apache2           
25563 www-data  15   0 99.9m  10m 5884 D    0  0.1   0:00.57 apache2           
25573 www-data  15   0  100m  11m 6076 D    0  0.1   0:00.61 apache2           
26619 www-data  15   0 99.9m  10m 5840 D    0  0.1   0:00.46 apache2           
26677 www-data  16   0 99.9m 9756 5292 S    0  0.1   0:00.48 apache2           
26863 www-data  15   0 99.9m 8728 4372 S    0  0.1   0:00.38 apache2           
26875 www-data  15   0   99m  10m 5852 D    0  0.1   0:00.48 apache2           
27018 www-data  15   0 99.9m 9732 5300 D    0  0.1   0:00.45 apache2           
27072 www-data  15   0 99.9m 9684 5292 D    0  0.1   0:00.42 apache2           
27394 www-data  16   0 99.8m 8684 4388 D    0  0.1   0:00.43 apache2   


ausserdem habe ich wirklich den prefork installiert.
wenn ich jedoch auf worker updaten will kommt folgende meldung:

Code: Select all

The following packages will be REMOVED
  apache2-mpm-prefork libapache2-mod-php5 libpam-plesk psa psa-api
  psa-php5-configurator


da ich Plesk zu laufen habe schätze ich mal das es danach nicht mehr läuft? :?

User avatar
Joe User
Project Manager
Project Manager
Posts: 11599
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by Joe User » 2008-11-02 23:11

Code: Select all

Tasks: 3145 total,   3 running, 3142 sleeping,   0 stopped,   0 zombie

3142 sleeping... über 3000 davon sind Dein viel zu hohes ServerLimit, nimm es raus, der Default von 256 reicht dicke...
Wie sieht die robots.txt aus? pconnect in der php.ini deaktiviert?
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-03 10:40

Guten Morgen!

die robots habe ich alle ausgesperrt und pconnect ist auf off.
ich warte jetzt mal bis der apache-server wieder hängt und lese dann den DB Status aus und den Apache Status.
Momentan läuft alles normal:
Apache Status:

Code: Select all

Server Version: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 
Server Built: Jan 27 2008 18:13:21

--------------------------------------------------------------------------------

Current Time: Monday, 03-Nov-2008 10:36:50 CET
Restart Time: Monday, 03-Nov-2008 10:14:44 CET
Parent Server Generation: 0
Server uptime: 22 minutes 6 seconds
199 requests currently being processed, 17 idle workers
WRCCCWCWCWCCCCCWCCC.C.CCCCW..CCWRWCC..C.CC_..C.........WC.C...C.
C.......C...C.C....R.....C.C................W.......C..C......C.
.............C.......C..._...RWW.C.......CW..........C.C.....C..
.._C...CC................W.........C..W..W.W...C_............C..
...R.....C......._..RW....C............C_.R.C_...........R......
.........C.............R......C.C...........RC......CW..........
W..C......C.........C.C...W..........CC...........C.C....C....W.
C.CC.C......C..R....................C........_....CCC...........
...CC.......C..C.........C.C......C..........C.........W..C..CW.
................CC.........._..............C...........C......C.
..............CR......C.....C...C.C..WW...C..C_..R.R.R..C.W.C...
CW..............C.C................C.....RC.CC..C.C.W.._.......W
R.R..R.CC.C............C..C..R.........R....._..._........W..W..
..CW.CC.CR.....C...R..W........C_....C...C..C._.......C.C..W....
.......W.R......CW..C......C......W.._CC_.........W....CR...C...



und hier mal die DB Config:

Code: Select all

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port      = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice      = 0

[mysqld]
set-variable=local-infile=0
#
# * Basic Settings
#
user      = mysql
pid-file   = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port      = 3306
basedir      = /usr
datadir      = /var/lib/mysql
tmpdir      = /tmp
language   = /usr/share/mysql/english
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address      = 127.0.0.1
#
# * Fine Tuning
#
max_connections = 2500
key_buffer = 96M
myisam_sort_buffer_size = 64M
join_buffer_size = 2M
read_buffer_size = 1M
sort_buffer_size = 4M
table_cache = 6000
thread_cache_size = 440
wait_timeout = 45
connect_timeout = 10
tmp_table_size = 96M
max_heap_table_size = 64M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
thread_concurrency = 4
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 8M
query_cache_size = 256M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
#query_cache_limit       = 1M
#query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log      = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
log_slow_queries   = /var/log/mysql/mysql-slow.log
long_query_time = 7
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
#server-id      = 1
#log_bin         = /var/log/mysql/mysql-bin.log
# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
#expire_logs_days   = 10
#max_binlog_size         = 100M
#binlog_do_db      = include_database_name
#binlog_ignore_db   = include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet   = 16M

[mysql]
#no-auto-rehash   # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 16M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
#
!includedir /etc/mysql/conf.d/


stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-03 11:16

darauf basierend hatte ich die connections schon angehoben:
MAX CONNECTIONS
Current max_connections = 2500
Current threads_connected = 22
Historic max_used_connections = 2501
The number of used connections is 100% of the configured maximum.
You should raise max_connections

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-03 15:30

Die Sache ist doch aber, daß wenn ich Apachen und MySQL auf Server #1 laufen lasse alles läuft, halt nur ein bißchen langsamer in den Abendstunden wenn 2-3000 user online sind.
Sobald ich die beiden Trenne schmiert der Apache regelmäßig ab.

Ich habe die Einstellungen ein bißchen angepasst und sehe zur Sekunde folgendes kurioses:
top im Server #1 (Apache)

Code: Select all

top - 15:21:05 up 13 days,  6:33,  1 user,  load average: 1.84, 2.05, 1.86
Tasks: 2230 total,   1 running, 2228 sleeping,   0 stopped,   1 zombie
Cpu(s): 17.6%us,  7.6%sy,  0.0%ni, 73.3%id,  0.2%wa,  0.1%hi,  1.2%si,  0.0%st
Mem:  16630960k total,  9338568k used,  7292392k free,    94324k buffers
Swap:  1028148k total,        0k used,  1028148k free,  3613332k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
15992 root      16   0  3580 2320  776 R   12  0.0   0:00.13 top               
 8960 www-data  16   0  100m  11m 6216 S   10  0.1   0:02.78 apache2           
13043 www-data  15   0  101m  11m 5868 S    7  0.1   0:00.35 apache2           
 7566 www-data  15   0  101m  13m 7504 S    5  0.1   0:01.50 apache2           
10903 www-data  15   0 99.5m  10m 6036 S    3  0.1   0:00.55 apache2           
12150 www-data  15   0 99.8m  10m 6020 S    3  0.1   0:01.24 apache2           
12843 www-data  15   0 99.5m  10m 5932 S    3  0.1   0:00.32 apache2           
12868 www-data  16   0 99.5m 9696 5248 S    3  0.1   0:00.45 apache2           
13920 www-data  17   0 99.7m  10m 5984 S    3  0.1   0:00.97 apache2           
15342 www-data  17   0 99.5m 9.8m 5628 S    3  0.1   0:00.08 apache2           
 5176 www-data  15   0  101m  14m 8724 S    2  0.1   0:01.25 apache2           
 5369 www-data  15   0  100m  12m 7644 S    2  0.1   0:02.59 apache2           
 5493 www-data  15   0  100m  11m 6092 S    2  0.1   0:02.27 apache2           
 5555 www-data  15   0 99.6m  10m 6292 S    2  0.1   0:02.66 apache2           
 5949 www-data  15   0  102m  13m 6256 S    2  0.1   0:01.77 apache2           
 6036 www-data  15   0  101m  15m 8916 S    2  0.1   0:00.67 apache2           
 6206 www-data  15   0 99.7m  10m 6416 S    2  0.1   0:02.05 apache2   



wenn dann mit dem Befehl

Code: Select all

netstat -anp |grep 'tcp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n 


Sehe ich als Connections
14371 192.168.0.2

192.168.0.2 ist dabei der MySQL server. Das sind heftig viele die da offen sind!

Auch der Apache-Status (module) meldet:

Code: Select all

Current Time: Monday, 03-Nov-2008 15:19:57 CET 
Restart Time: Monday, 03-Nov-2008 10:14:44 CET
Parent Server Generation: 0
Server uptime: 5 hours 5 minutes 12 seconds
1523 requests currently being processed, 632 idle workers
_WRCRRR._RR__RR_RC_RRRWRRW___RRWC_R_RRRCRC_R_RRCCR__.CR_RRR___RR
R__C_RC_R__CR.RRRC_C_R_CRRRRRRC_R_C_RRCR_RRRCRR_RRC__RRRCRRR_RR_
_RR_CR___.RRRRRRRRRR_RRRRC__CC_R.RRRCRC__RRCCR_R__R_CRR_RCR.R.RC
RRRRR_R_._RRRR_.R__RRRRCR_.R_RC_R__RC._RC..WRCR_CR_CRCRRRRRRR___
RRRCRR_R_RRRR_R_RR.__R_RR_RRCRRRRR_C___RRRR_R__RRRR_R_RRR_R_RRR_
RRRRRRR.RRCRR_.RR_RCRRRRRRR.RRRR_RRRR_RCRR_RRRRRRRR_.._RRRRCRC_C
.RR__RR_R_RCRCC_.__RR_RRR_RR.RCC_CRRRRRRC._C__CRR.C_R_R_CCRR___C
R_R.CRR_RRRRR__R__RRRRRR.RRRR__R_R_RRCRWRRRRR_CRCCC_RRCRR_R_RRRR
CRR___RRRR_RR_RRC.W_WRRRWRRR_R_RRCRCC_RR_RR.CRRRW._RCRRR.WR_W_RR
RRRRR.RW_R_CCRR_.___RWRRC_R_RC_CR.R_.._RR_RRRR.___R._R__R__RR.R_
R___R_R_RRR_RR_RRR___R.RRR_RRR._RRRRRRR_RCR_RRRR_RRRRR_RR____R_R
_R__RW_RRR.C_C_RR_R_RRR.R_RRR__R_RR__RRW_R.RRR__R__WRR__R_RRRR_R
RR.R_R_R_R_.__R__RRRR_RRRR_CR_CRRRRR_R_R_RRR_RR._CRRRRRRRRRR__RR
RRR_CR__R_CRCC_RR_RWR_R.RRCRC_RRR.__RR__R_R_RRR_RR_.RC.R.RR_._C_
RR_RR_R_RCRRR_R.WC.RR_RRC_C_C_RRRC_.RRR_RCR_RRRRR_RR_RRR__C_.RRR
__C_RRRRR__R.R_RRRCRRCR_R.R_R_R_RRRRRRRW_CRR_RRRCRC__RR.RRRRC_RC
_R___R_RRR..RR_RR___RR_RRRR__RRRR__RWW._RR_RRWRRR__RR_R___RRRRCR
R____R_____R_R_RRRRRRR.WRR___RRWR_RRRR_RRC_RC.RRRRC_RRCRR__RCR.R
C_C__RRRWRR_CR._CRR_RR_C_RR_R_CRR_____RRR_RRRCRRRRRR_RR___RR_R_R
RRRRRR__R_W.C_R_RRRRRRR.__C_RR___RRRR__RCRRWR__C__RCR_RC_CWCR_CR
RRRRCRRRRR_RCRR_____R_RRRR_R._RRR__CRR.__RCRRCR_RRR_._RR_RRR.RRR
RR.WR_RCR.R___RRRR__R_C_RRR_RRRR_RCR__CRRR_RRR_RRCRRRR_RCRRRR_CR
R_RRRCRR_CRRRC__RRR_RC___RRRR_CRRWR__RRCR_RR.RRRRRRR_RR_RW._R_R_
_RRC____R_._C__W__R.RRR_RCRRRRW__CR.RRR.CCR_R_RR_R.R_R.R_.C_CR__
RRRR_R_.RWR.C.RRCCR_CRRRCRRR_R_WR_RRRCCCRRRRRRRR_R_R_R_RWRRRWRRC
RRRR__.R_RRRRR___R__R.RC_R_R__RR_CCRR_R_RRW__C__CCRRRR_RRCRCRC__
RRRRC..__CRRR___WR_RRRRCRRRRRR_C_RRRRRR_R__RC_RRRC___R_RR_RRW__R
_RR_RR.RRRR_RRC_RRR.__R_RRR_.RR_._RRRCWRRRRC..R_RRR__R_RRRRRC__R
RR.RRRR_R__R_CR_RRC_R_R_RRRRRRR___CR_RRW_RC__C_.R_RWRRC..RRRRRR.
R_R_._RRCRCC_RR.RW_RR_R_CRR__R_R__CRCRCRRR.RR.R_.RRRR._RRR._RCR.
_RRRR__C_R__RWR_CRRRRR_R__C_RRRRCRRRRCR_RRRR_R__C_R__RR___RRRRRC
CR_RR__R_R_RRRC_RCRR_C.RRRR_RR_RRRRR_RRR_C_R_RRWR__RRRWR_.RRRC__
__RRW_____RRWR___RR_RRCRR_R_RWCRRRCCRR_R__R_CRCC__RRRCC_CR_____C
RR_R_R_RR__CR_.RRR_CRR_.RCRRRWRR_R._CR_RRRRRRCR_R_RRR_RRR_RRCR_R
RR_R_C_CC.W.CRWR_R__R_RRRRRR__.RRRRRRRRRCR__RRWRRRRR_WRR_RCR.C_R
R_RRRRR_CR_RRRRRRRRR_RRRRRR_RC._RR..........................


Wenn ich zum gleichen Zeitpunkt auf dem MySQL Server den Befehl:
netstat -anp |grep 'tcp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
sehe ich
216 192.168.0.1
da sinds nur 216....

Hier läuft doch irgendwas ganz mächtig schief?!

stamos
Posts: 66
Joined: 2003-05-17 18:21
Location: Berlin

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by stamos » 2008-11-03 18:23

so, jetzt hat er sich dann mal wieder verabschiedet, das am mittag war wohl in der tat ein DDOS

alles läuft 1a, es sind nicht viele user online und beide server haben ein load von 1-2 bis plötzlich der apache so aussieht:

Code: Select all

top - 18:14:42 up 13 days,  9:27,  1 user,  load average: 375.85, 688.49, 310.74
Tasks: 2447 total,   4 running, 2443 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.1%us, 15.2%sy,  0.0%ni, 80.5%id,  1.6%wa,  0.1%hi,  0.6%si,  0.0%st
Mem:  16630960k total,  8946728k used,  7684232k free,    98508k buffers
Swap:  1028148k total,        0k used,  1028148k free,  3644828k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
22354 www-data  16   0  102m  12m 5360 R    8  0.1   0:00.62 apache2           
23103 root      16   0  3708 2536  852 R    2  0.0   0:00.46 top               
16346 www-data  16   0  101m  15m 8940 D    1  0.1   0:03.20 apache2           
18358 www-data  15   0  102m  16m 8696 D    1  0.1   0:01.95 apache2           
20040 www-data  16   0 99.7m 9936 5456 S    1  0.1   0:00.44 apache2           
21693 www-data  15   0 99.7m 9512 5084 D    1  0.1   0:00.16 apache2           
16475 www-data  15   0  101m  14m 8764 D    0  0.1   0:02.89 apache2           
16494 www-data  15   0 99.9m  10m 6212 D    0  0.1   0:01.58 apache2           
17285 www-data  15   0  100m  13m 8912 D    0  0.1   0:02.20 apache2           
18316 www-data  15   0 99.9m  12m 8304 D    0  0.1   0:01.35 apache2           
18503 www-data  15   0  101m  12m 6264 D    0  0.1   0:02.01 apache2           
19654 www-data  15   0 99.9m  10m 5632 D    0  0.1   0:01.11 apache2           
19723 www-data  15   0  101m  12m 6076 D    0  0.1   0:00.52 apache2           
21065 www-data  15   0 99.7m 9652 5108 D    0  0.1   0:00.18 apache2           
21506 www-data  16   0 99.5m 9656 5304 S    0  0.1   0:00.19 apache2   


wenn ich mir die verbindungen auslese mit

Code: Select all

netstat -anp |grep 'tcp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

dann sind es nur ein paar wenige als wenn der sever normal läuft:

Code: Select all

     13 91.132.57.249
....
     18 78.158.128.188
     23 0.0.0.0
   1210 192.168.0.2


der mysql server idelt dann vor sich hin und status sagt:

Code: Select all

Connection id:          1626466
Current database:       tracker
Current user:           admin@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.32-Debian_7etch6-log Debian etch distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    utf8
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /var/run/mysqld/mysqld.sock
Uptime:                 1 hour 48 min 41 sec

Threads: 452  Questions: 12344500  Slow queries: 3  Opens: 2146  Flush tables: 1  Open tables: 2021  Queries per second avg: 1893.038


ich bekomme es nicht gebacken, total unlogisches verhalten ](*,)

kane
Posts: 82
Joined: 2002-10-04 01:22

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by kane » 2008-11-19 13:47

Hallo zusammen!

Ich habe fast das gleiche Problem wie oben beschrieben.
Wir setzen 2 Webserver ein, die hinter einem Loadbalancer stehen. Zusätzlich gibt es noch einen DB (Oracle) Server.

Unser Problem ist folgendes:

Der Apache (beide) können pro Child-Prozess 150 Anfragen handeln.
Die max. Sessionanzahl (Verbindungen gesamt von beiden Apaches) zur DB sind 300.
Zum Connecten benutzen wir ocipconnect() und am Ende oci_close().
Summe der inaktiven Sessions liegt bei Stoßzeiten zwischen 180 und 250.
Aktive Sessions sind ca. 10-20...

In der PHP.ini haben wir folgendes stehen:
oci8.persistent_timeout = 300 (vorher 6000)
oci8.max_persistent = -1
oci8.ping_interval = 60

Trotz der Änderung von oci8.persistent_timeout auf 300 (5 Minuten) hat sich nichts getan.
Aus irgendeinem Grund kann er die offenen inaktiven Sessions nicht wieder aufgreifen, so dass irgendwann die Anzahl der erlaubten Sessions überschritten ist und wir die DB/Apaches durchstarten müssen.

Hat da jemand eine Idee? Kann es ggf. mit dem vorgeschalteten Loadbalancer zu tun haben?

Danke im Voraus.
Grüße

User avatar
rudelgurke
Systemtester
Systemtester
Posts: 408
Joined: 2008-03-12 05:36

Re: Hilfe mit Apache Setup und Crosslinked DB-Server

Post by rudelgurke » 2008-11-19 16:40

Hmmm - wenn dort auf 1. Server ein IPB läuft - wie sieht's denn da mit der Konfiguration aus ? Irgendwelche Addons installiert - Image Resizer / Shoutbox usw. usw. und der Gastzugriff ?