summaryrefslogtreecommitdiffstats
path: root/Documentation/documentation.lyx
diff options
context:
space:
mode:
authorGravatar Christopher Powell 2002-12-18 01:06:33 +0000
committerGravatar Christopher Powell 2002-12-18 01:06:33 +0000
commit0d8d2676e9b345eb66d2d3a145fbf64d1429a9b2 (patch)
treea5a4c148a5a68969fe76e8a80c9ed01f979cb7b5 /Documentation/documentation.lyx
parenta82db79fcf12e4a414c0a0862ed38b9e3a964c70 (diff)
Delayed inserts, includes, better table creation, renamed global vars,
Diffstat (limited to 'Documentation/documentation.lyx')
-rw-r--r--Documentation/documentation.lyx623
1 files changed, 409 insertions, 214 deletions
diff --git a/Documentation/documentation.lyx b/Documentation/documentation.lyx
index 69f09ae..ba02f76 100644
--- a/Documentation/documentation.lyx
+++ b/Documentation/documentation.lyx
@@ -422,24 +422,31 @@ Perform all the following steps as root so that you have install privs,
422\end_deeper 422\end_deeper
423\layout Enumerate 423\layout Enumerate
424 424
425You must know the paths to some installed software before continuing. 425Edit Makefile and change the values of the variables in the first section.
426
426\begin_deeper 427\begin_deeper
427\layout Enumerate 428\layout Enumerate
428 429
429These are 430These paths are
430\series bold 431\series bold
431necessary: 432necessary:
432\begin_deeper 433\begin_deeper
433\layout Itemize 434\layout Description
434 435
435The location where you installed Apache -- usually /usr/local/apache, 'locate 436APACHEINSTALLED: the location where you installed Apache -- usually /usr/local/a
436 apxs' can help you find it. 437pache, 'locate apxs' can help you find it.
437\layout Itemize 438\layout Description
438 439
439The location of your MySQL libraries, find using 'locate libmysqlclient.so' 440APACHEHEADERS: The location of your Apache header files, find using 'locate
440\layout Itemize 441 httpd.h'
442\layout Description
443
444MYSQLLIBRARIES: The location of your MySQL libraries, find using 'locate
445 libmysqlclient.so'
446\layout Description
441 447
442The location of your MySQL header files, find using 'locate mysql.h' 448MYSQLHEADERS: The location of your MySQL header files, find using 'locate
449 mysql.h'
443\end_deeper 450\end_deeper
444\layout Enumerate 451\layout Enumerate
445 452
@@ -450,12 +457,13 @@ Optional
450: if you compiled mod_ssl for Apache and want to log SSL data such as 'keysize' 457: if you compiled mod_ssl for Apache and want to log SSL data such as 'keysize'
451 and 'cipher type': 458 and 'cipher type':
452\begin_deeper 459\begin_deeper
453\layout Itemize 460\layout Description
454 461
455The location of your SSL header files, find using 'locate mod_ssl.h' 462MODSSLHEADERS: the location of your mod_ssl header files, find using 'locate
456\layout Itemize 463 mod_ssl.h'
464\layout Description
457 465
458The location of your db1 header files, find using 'locate ndbm.h' 466DB1HEADERS: the location of your db1 header files, find using 'locate ndbm.h'
459\end_deeper 467\end_deeper
460\layout Standard 468\layout Standard
461 469
@@ -473,13 +481,9 @@ such as the cipher type.
473\end_deeper 481\end_deeper
474\layout Enumerate 482\layout Enumerate
475 483
476Now that you know these things, edit Makefile and replace the stock values
477 with your own.
478\begin_deeper
479\layout Standard
480
481IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS by putting 484IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS by putting
482 a # character in front of it: 485 a # character in front of it:
486\begin_deeper
483\layout LyX-Code 487\layout LyX-Code
484 488
485#MODSSLHDRS=/usr/include/... 489#MODSSLHDRS=/usr/include/...
@@ -496,15 +500,14 @@ Instruct apxs to compile the module as a DSO.
496You should see output similar to the following: 500You should see output similar to the following:
497\layout LyX-Code 501\layout LyX-Code
498 502
499/usr/local/Apache/bin/apxs -Wc,-O2 -Wc,-Wall -Wc,-DEAPI -c -I/usr/incl... 503/usr/local/Apache/bin/apxs -Wc,-O2 -Wc,-Wall -Wc,-DEAPI -c -I/usr/...
500
501\layout LyX-Code 504\layout LyX-Code
502 505
503gcc -DLINUX=22 -DNO_DBM_REWRITEMAP -DMOD_SSL=208111 -DUSE_HSREGEX -DEAPI... 506gcc -DLINUX=22 -DNO_DBM_REWRITEMAP -DMOD_SSL=208111 -DUSE_HS...
504 507
505\layout LyX-Code 508\layout LyX-Code
506 509
507gcc -shared -o mod_log_sql.so mod_log_sql.o -Wc,-O2 -Wc,-Wall -Wc,-DEAPI... 510gcc -shared -o mod_log_sql.so mod_log_sql.o -Wc,-O2 -Wc,-Wall -Wc...
508\layout Standard 511\layout Standard
509 512
510You should see no errors and have a new file called "mod_log_sql.so" in your 513You should see no errors and have a new file called "mod_log_sql.so" in your
@@ -650,7 +653,8 @@ Unpack the archive into a working directory.
650 653
651\end_inset 654\end_inset
652 655
653You must know the paths to some installed software before continuing. 656Edit Makefile and change the values of the variables in the first section.
657
654\begin_deeper 658\begin_deeper
655\layout Enumerate 659\layout Enumerate
656 660
@@ -658,21 +662,29 @@ These are
658\series bold 662\series bold
659necessary: 663necessary:
660\begin_deeper 664\begin_deeper
661\layout Itemize 665\layout Description
662 666
663The location where you installed Apache -- usually /usr/local/apache, 'locate 667APACHEINSTALLED: the location where you installed Apache -- usually /usr/local/a
664 apxs' can help you find it. 668pache, 'locate apxs' can help you find it.
665 669\layout Description
666\layout Itemize
667 670
668The location of your Apache *sources*, find using 'locate ABOUT_APACHE' 671APACHESOURCE: the location of your Apache
669 672\series bold
670\layout Itemize 673sources
674\series default
675, find using 'locate ABOUT_APACHE'
676\layout Description
671 677
672The location of your MySQL header files, find using 'locate mysql.h' 678APACHEHEADERS: The location of your Apache header files, find using 'locate
673\layout Itemize 679 httpd.h'
680\layout Description
681
682MYSQLLIBRARIES: The location of your MySQL libraries, find using 'locate
683 libmysqlclient.so'
684\layout Description
674 685
675The location of your MySQL libraries, find using 'locate libmysqlclient.so' 686MYSQLHEADERS: The location of your MySQL header files, find using 'locate
687 mysql.h'
676\end_deeper 688\end_deeper
677\layout Enumerate 689\layout Enumerate
678 690
@@ -683,12 +695,13 @@ Optional
683: if you compiled mod_ssl for Apache and want to log SSL data such as 'keysize' 695: if you compiled mod_ssl for Apache and want to log SSL data such as 'keysize'
684 and 'cipher type': 696 and 'cipher type':
685\begin_deeper 697\begin_deeper
686\layout Itemize 698\layout Description
687 699
688The location of your mod_ssl header files, find using 'locate mod_ssl.h' 700MODSSLHEADERS: the location of your mod_ssl header files, find using 'locate
689\layout Itemize 701 mod_ssl.h'
702\layout Description
690 703
691The location of your db1 header files, find using 'locate ndbm.h' 704DB1HEADERS: the location of your db1 header files, find using 'locate ndbm.h'
692\end_deeper 705\end_deeper
693\layout Standard 706\layout Standard
694 707
@@ -706,13 +719,9 @@ if you want to log SSL-specific data
706\end_deeper 719\end_deeper
707\layout Enumerate 720\layout Enumerate
708 721
709Now that you know these things, edit Makefile and replace the stock values
710 with your own.
711\begin_deeper
712\layout Standard
713
714IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS by putting 722IMPORTANT: If you are not logging SSL info, comment out MODSSLHDRS by putting
715 a # character in front of it: 723 a # character in front of it:
724\begin_deeper
716\layout LyX-Code 725\layout LyX-Code
717 726
718#MODSSLHDRS=/usr/include/... 727#MODSSLHDRS=/usr/include/...
@@ -987,15 +996,6 @@ A very basic logging setup in Apache
987Tell the module what database to use and the appropriate authentication 996Tell the module what database to use and the appropriate authentication
988 information. 997 information.
989\begin_deeper 998\begin_deeper
990\layout Quote
991
992
993\series bold
994Example:
995\series default
996 Use the MySQL database called "apachelogs" running on "dbmachine.foo.com".
997 Use username "loguser" and password "l0gger" to authenticate to the database.
998 Let the module create tables for us.
999\layout Standard 999\layout Standard
1000 1000
1001So, edit httpd.conf and insert the following lines somewhere after any LoadModule 1001So, edit httpd.conf and insert the following lines somewhere after any LoadModule
@@ -1014,9 +1014,29 @@ global,
1014 not inside any VirtualHost stanza 1014 not inside any VirtualHost stanza
1015\emph default 1015\emph default
1016. 1016.
1017 You will also note that you are embedding a password in the file.
1018 Therefore you are advised to
1019\begin_inset Quotes eld
1020\end_inset
1021
1022chmod 660 httpd.conf
1023\begin_inset Quotes erd
1024\end_inset
1025
1026 to prevent unauthorized regular users from viewing your database user and
1027 password.
1028\layout Standard
1029
1030
1031\series bold
1032Example
1033\series default
1034: Use the MySQL database called "apachelogs" running on "dbmachine.foo.com".
1035 Use username "loguser" and password "l0gg3r" to authenticate to the database.
1036 Permit the module create tables for us.
1017\layout LyX-Code 1037\layout LyX-Code
1018 1038
1019LogSQLLoginInfo dbmachine.foo.com loguser l0gger 1039LogSQLLoginInfo dbmachine.foo.com loguser l0gg3r
1020\layout LyX-Code 1040\layout LyX-Code
1021 1041
1022LogSQLDatabase apachelogs 1042LogSQLDatabase apachelogs
@@ -1111,74 +1131,18 @@ Several lines of output should follow, corresponding to your hits on the
1111 You now have basic functionality. 1131 You now have basic functionality.
1112 Don't disable your regular Apache logs until you feel comfortable that 1132 Don't disable your regular Apache logs until you feel comfortable that
1113 the database is behaving as you'd like and that things are going well. 1133 the database is behaving as you'd like and that things are going well.
1134 If you do not see any entries in the access_log, please consult section
1135
1136\begin_inset LatexCommand \ref{faq:NothingLogged}
1137
1138\end_inset
1139
1140 of the FAQ on how to debug and fix the situation.
1114\end_deeper 1141\end_deeper
1115\layout Enumerate 1142\layout Enumerate
1116 1143
1117You can now activate the advanced features of mod_log_sql, which are described 1144You can now activate the advanced features of mod_log_sql, which are described
1118 in the next section. 1145 in the next section.
1119 If you do not see any entries in the access_log, then something is preventing
1120 the inserts from happening.
1121 This could be caused by several things:
1122\begin_deeper
1123\layout Itemize
1124
1125Improper privileges set up in the MySQL database
1126\layout Itemize
1127
1128You aren't hitting a VirtualHost that has a
1129\noun on
1130LogSQLTransferLogTable
1131\noun default
1132 entry
1133\layout Itemize
1134
1135You didn't specify the right database host or login information
1136\layout Standard
1137
1138So, first examine the MySQL log that you established in step
1139\begin_inset LatexCommand \ref{step:EnaLog}
1140
1141\end_inset
1142
1143 of section
1144\begin_inset LatexCommand \ref{sub:PrepDb}
1145
1146\end_inset
1147
1148.
1149 Ensure that the INSERT statements are not being rejected because of a malformed
1150 table name or other typographical error.
1151 By enabling that log, you instructed MySQL to log every connection and
1152 command it receives -- if you see no INSERT attempts in the log, the module
1153 isn't successfully connecting to the database.
1154 If you see nothing at all in the log -- not even a record of your administrativ
1155e connection attempts, then you did not enable the log correctly.
1156 If you do see INSERT attempts but they are failing, the log should tell
1157 you why.
1158\layout Standard
1159
1160Second, confirm that your
1161\noun on
1162LogSQL*
1163\noun default
1164 directives are all correct.
1165\layout Standard
1166
1167Third, examine the Apache
1168\noun on
1169
1170\noun default
1171error logs for messages from mod_log_sql; the module will offer hints as
1172 to why it cannot connect, etc.
1173
1174\layout Standard
1175
1176The next thing to do is recompile the module with debugging output activated.
1177 change the "#undef DEBUG" on line 8 of mod_log_sql.c to "#define DEBUG"
1178 and recompile/reinstall.
1179 The module will now output copious notes about what it is doing, and this
1180 will help you (and the maintainer) solve the problem.
1181\end_deeper
1182\layout Subsection 1146\layout Subsection
1183 1147
1184How to tune logging with run-time directives 1148How to tune logging with run-time directives
@@ -2537,8 +2501,9 @@ Optimizing for a busy database
2537 2501
2538A busy MySQL database will have SELECT statements running concurrently with 2502A busy MySQL database will have SELECT statements running concurrently with
2539 INSERT and UPDATE statements. 2503 INSERT and UPDATE statements.
2540 A long-running SELECT can block INSERTs, therefore will block mod_log_sql. 2504 A long-running SELECT can in certain circumstances block INSERTs and therefore
2541 This may be solved by compiling mod_log_sql for 2505 block mod_log_sql.
2506 A workaround is to compile mod_log_sql for
2542\begin_inset Quotes eld 2507\begin_inset Quotes eld
2543\end_inset 2508\end_inset
2544 2509
@@ -2907,7 +2872,15 @@ host
2907\begin_inset Quotes erd 2872\begin_inset Quotes erd
2908\end_inset 2873\end_inset
2909 2874
2910 is the hostname or IP address of the MySQL machine. 2875 is the hostname or IP address of the MySQL machine, and is simply
2876\begin_inset Quotes eld
2877\end_inset
2878
2879localhost
2880\begin_inset Quotes erd
2881\end_inset
2882
2883 if the database lives on the same machine as Apache.
2911 2884
2912\begin_inset Quotes eld 2885\begin_inset Quotes eld
2913\end_inset 2886\end_inset
@@ -3397,7 +3370,7 @@ Each character in the format-string defines an attribute of the request
3397\size footnotesize 3370\size footnotesize
3398 3371
3399\begin_inset Tabular 3372\begin_inset Tabular
3400<lyxtabular version="3" rows="21" columns="5"> 3373<lyxtabular version="3" rows="22" columns="5">
3401<features> 3374<features>
3402<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt"> 3375<column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
3403<column alignment="left" valignment="top" width="0pt"> 3376<column alignment="left" valignment="top" width="0pt">
@@ -3515,6 +3488,48 @@ Mozilla/4.0 (compat; MSIE 6.0; Windows)
3515 3488
3516\layout Standard 3489\layout Standard
3517 3490
3491a
3492\end_inset
3493</cell>
3494<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3495\begin_inset Text
3496
3497\layout Standard
3498
3499CGI request arguments
3500\end_inset
3501</cell>
3502<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3503\begin_inset Text
3504
3505\layout Standard
3506
3507request_args
3508\end_inset
3509</cell>
3510<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3511\begin_inset Text
3512
3513\layout Standard
3514
3515varchar(255)
3516\end_inset
3517</cell>
3518<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3519\begin_inset Text
3520
3521\layout Standard
3522
3523user=Smith&cart=1231&item=532
3524\end_inset
3525</cell>
3526</row>
3527<row topline="true">
3528<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3529\begin_inset Text
3530
3531\layout Standard
3532
3518 3533
3519\size footnotesize 3534\size footnotesize
3520b 3535b
@@ -5724,6 +5739,273 @@ Please contact
5724 course. 5739 course.
5725\layout Subsection 5740\layout Subsection
5726 5741
5742Problems
5743\layout Subsubsection
5744
5745Apache segfaults when using PHP and mod_log_sql
5746\layout Standard
5747
5748This occurs if you compiled PHP with MySQL database support.
5749 PHP utilizes its internal, bundled MySQL libraries by default.
5750 These conflict with the
5751\begin_inset Quotes eld
5752\end_inset
5753
5754real
5755\begin_inset Quotes erd
5756\end_inset
5757
5758 MySQL libraries linked by mod_log_sql, causing the segmentation fault.
5759
5760\layout Standard
5761
5762The solution is to configure PHP to link against the real MySQL libraries
5763 and recompile mod_php.
5764 Apache will run properly once the modules are all using the same version
5765 of the MySQL libraries.
5766\layout Subsubsection
5767
5768
5769\begin_inset LatexCommand \label{faq:NothingLogged}
5770
5771\end_inset
5772
5773Apache appears to start up fine, but nothing is getting logged in the database
5774\layout Standard
5775
5776If you do not see any entries in the access_log, then something is preventing
5777 the inserts from happening.
5778 This could be caused by several things:
5779\layout Itemize
5780
5781Improper privileges set up in the MySQL database
5782\layout Itemize
5783
5784You aren't hitting a VirtualHost that has a LogSQLTransferLogTable entry
5785
5786\layout Itemize
5787
5788You didn't specify the right database host or login information
5789\layout Itemize
5790
5791Another factor is preventing a connection to the database
5792\layout Standard
5793
5794Important: it is improper to ask for help before you have followed these
5795 steps.
5796\layout Standard
5797
5798First examine the MySQL log that you established in step
5799\begin_inset LatexCommand \ref{step:EnaLog}
5800
5801\end_inset
5802
5803 of section
5804\begin_inset LatexCommand \ref{sub:PrepDb}
5805
5806\end_inset
5807
5808.
5809 Ensure that the INSERT statements are not being rejected because of a malformed
5810 table name or other typographical error.
5811 By enabling that log, you instructed MySQL to log every connection and
5812 command it receives -- if you see no INSERT attempts in the log, the module
5813 isn't successfully connecting to the database.
5814 If you see nothing at all in the log -- not even a record of your administrativ
5815e connection attempts, then you did not enable the log correctly.
5816 If you do see INSERT attempts but they are failing, the log should tell
5817 you why.
5818\layout Standard
5819
5820Second, confirm that your
5821\noun on
5822LogSQL*
5823\noun default
5824 directives are all correct.
5825\layout Standard
5826
5827Third, examine the Apache
5828\noun on
5829
5830\noun default
5831error logs for messages from mod_log_sql; the module will offer hints as
5832 to why it cannot connect, etc.
5833
5834\layout Standard
5835
5836The next thing to do is recompile the module with debugging output activated.
5837 change the "#undef DEBUG" on line 8 of mod_log_sql.c to "#define DEBUG"
5838 and recompile/reinstall.
5839 The module will now output copious notes about what it is doing, and this
5840 will help you (and the maintainer) solve the problem.
5841 In order to see the debugging messages, ensure that you make them visible
5842 using the
5843\noun on
5844LogLevel
5845\noun default
5846directive
5847\series bold
5848in the main server config as well as in each
5849\noun on
5850VirtualHost
5851\noun default
5852config:
5853\layout LyX-Code
5854
5855LogLevel debug
5856\layout LyX-Code
5857
5858ErrorLog /var/log/httpd/server-messages
5859\layout Subsubsection
5860
5861Why do I get the message
5862\begin_inset Quotes eld
5863\end_inset
5864
5865configuration info is insufficient to log
5866\begin_inset Quotes erd
5867\end_inset
5868
5869 in my Apache error log?
5870\layout Standard
5871
5872At a minimum,
5873\noun on
5874LogSQLTransferLogTable
5875\noun default
5876 must be defined for the module to even attempt logging.
5877 If this directive is not defined for the server (or virtual server) you
5878 will receive this error message.
5879
5880\layout Subsubsection
5881
5882Why do I get the message
5883\begin_inset Quotes eld
5884\end_inset
5885
5886insufficient configuration info to establish database link
5887\begin_inset Quotes erd
5888\end_inset
5889
5890 in my Apache error log?
5891\layout Standard
5892
5893At a minimum,
5894\noun on
5895LogSQLDatabase
5896\noun default
5897 and
5898\noun on
5899LogSQLLoginInfo
5900\noun default
5901must be defined in order for the module to be able to establish a database
5902 link.
5903 If these are not defined or are incomplete you will receive this error
5904 message.
5905\layout Subsubsection
5906
5907My database cannot handle all the open connections from mod_log_sql, is
5908 there anything I can do?
5909\layout Standard
5910
5911The rule of thumb: if you have
5912\emph on
5913n
5914\emph default
5915webservers each configured to support
5916\emph on
5917y
5918\emph default
5919
5920\noun on
5921MaxClients
5922\noun default
5923, then your database must be able to handle
5924\begin_inset Formula $n\times y$
5925\end_inset
5926
5927 simultenous connections
5928\emph on
5929in the worst case.
5930
5931\emph default
5932Certainly you must use common sense, consider reasonable traffic expectations
5933 and structure things accordingly.
5934\layout Standard
5935
5936Tweaking my.cnf to scale to high connection loads is imperative.
5937 But if hardware limitations prevent your MySQL server from gracefully handling
5938 the number of incoming connections, it would be beneficial to upgrade the
5939 memory or CPU on that server in order to handle the load.
5940
5941\layout Standard
5942
5943Jeremy Zawodny, a highly respected MySQL user and contributor to Linux Magazine,
5944 has this very helpful and highly appropriate article on tuning MySQL:
5945\begin_inset LatexCommand \url{http://jeremy.zawodny.com/blog/archives/000173.html}
5946
5947\end_inset
5948
5949
5950\layout Standard
5951
5952Please remember that mod_log_sql's overriding principle is
5953\series bold
5954performance
5955\series default
5956 -- that is what the target audience demands and expects.
5957 Other database logging solutions do not open and maintain many database
5958 connections, but their performance suffers drastically.
5959 For example, pgLOGd funnels all log connections through a separate daemon
5960 that connects to the database, but that bottlenecks the entire process.
5961 mod_log_sql achieves performance numbers an order of magnitude greater
5962 than the alternatives because it dispenses with the overhead associated
5963 with rapid connection cycling, and it doesn't attempt to shoehorn all the
5964 database traffic through a single extra daemon or proxy process.
5965\layout Subsubsection
5966
5967Why do I occasionally see a
5968\begin_inset Quotes eld
5969\end_inset
5970
5971lost connection to MySQL server
5972\begin_inset Quotes erd
5973\end_inset
5974
5975 message in my Apache error log?
5976\layout Standard
5977
5978This message may appear every now and then in your Apache error log, especially
5979 on very lightly loaded servers.
5980 This doesn't mean that anything is necessarily wrong.
5981 Within each httpd child process, mod_log_sql will open (and keep open)
5982 a connection to the MySQL server.
5983 MySQL, however, will close connections that haven't been used in a while;
5984 the default timeout is 8 hours.
5985 When this occurs, mod_log_sql will notice and re-open the connection.
5986 That event is what is being logged, and looks like this:
5987\layout LyX-Code
5988
5989[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: first attempt failed,
5990\layout LyX-Code
5991
5992 API said: error 2013, Lost connection to MySQL server during query
5993\layout LyX-Code
5994
5995[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful
5996\layout LyX-Code
5997
5998[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful
5999\layout Standard
6000
6001Reference:
6002\begin_inset LatexCommand \url[MySQL documentation]{(http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone_away)}
6003
6004\end_inset
6005
6006
6007\layout Subsection
6008
5727Performance and Tuning 6009Performance and Tuning
5728\layout Subsubsection 6010\layout Subsubsection
5729 6011
@@ -6007,58 +6289,7 @@ ps
6007 would lead you to believe. 6289 would lead you to believe.
6008\layout Subsubsection 6290\layout Subsubsection
6009 6291
6010My database cannot handle all the open connections from mod_log_sql, is 6292My webserver cannot handle all the traffic that my site receives, is there
6011 there anything I can do?
6012\layout Standard
6013
6014The rule of thumb: if you have
6015\emph on
6016n
6017\emph default
6018webservers each configured to support
6019\emph on
6020y
6021\emph default
6022
6023\noun on
6024MaxClients
6025\noun default
6026, then your database must be able to handle
6027\begin_inset Formula $n\times y$
6028\end_inset
6029
6030 simultenous connections
6031\emph on
6032in the worst case.
6033
6034\emph default
6035Certainly you must use common sense, consider reasonable traffic expectations
6036 and structure things accordingly.
6037\layout Standard
6038
6039Tweaking my.cnf to scale to high connection loads is imperative.
6040 But if hardware limitations prevent your MySQL server from gracefully handling
6041 the number of incoming connections, it would be beneficial to upgrade the
6042 memory or CPU on that server in order to handle the load.
6043
6044\layout Standard
6045
6046Please remember that mod_log_sql's overriding principle is
6047\series bold
6048performance
6049\series default
6050 -- that is what the target audience demands and expects.
6051 Other database logging solutions do not open and maintain many database
6052 connections, but their performance suffers drastically.
6053 For example, pgLOGd funnels all log connections through a separate daemon
6054 that connects to the database, but that bottlenecks the entire process.
6055 mod_log_sql achieves performance numbers an order of magnitude greater
6056 than the alternatives because it dispenses with the overhead associated
6057 with rapid connection cycling, and it doesn't attempt to shoehorn all the
6058 database traffic through a single extra daemon or proxy process.
6059\layout Subsubsection
6060
6061My webservers cannot handle all the traffic that my site receives, is there
6062 anything I can do? 6293 anything I can do?
6063\layout Standard 6294\layout Standard
6064 6295
@@ -6068,48 +6299,6 @@ If you have exhausted all the tuning possibilities on your existing server,
6068 In fact, users of such a setup are mod_log_sql's target audience! 6299 In fact, users of such a setup are mod_log_sql's target audience!
6069\layout Subsubsection 6300\layout Subsubsection
6070 6301
6071Why do I occasionally see a
6072\begin_inset Quotes eld
6073\end_inset
6074
6075lost connection to MySQL server
6076\begin_inset Quotes erd
6077\end_inset
6078
6079 message in my error-log?
6080\layout Standard
6081
6082This message may appear every now and then in your Apache error log, especially
6083 on very lightly loaded servers.
6084 This doesn't mean that anything is necessarily wrong.
6085 Within each httpd child process, mod_log_sql will open (and keep open)
6086 a connection to the MySQL server.
6087 MySQL, however, will close connections that haven't been used in a while;
6088 the default timeout is 8 hours.
6089 When this occurs, mod_log_sql will notice and re-open the connection.
6090 That event is what is being logged, and looks like this:
6091\layout LyX-Code
6092
6093[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: first attempt failed,
6094\layout LyX-Code
6095
6096 API said: error 2013, Lost connection to MySQL server during query
6097\layout LyX-Code
6098
6099[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful
6100\layout LyX-Code
6101
6102[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful
6103\layout Standard
6104
6105Reference:
6106\begin_inset LatexCommand \url[MySQL documentation]{(http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone_away)}
6107
6108\end_inset
6109
6110
6111\layout Subsubsection
6112
6113 6302
6114\begin_inset LatexCommand \label{sub:DelayedInsFAQ} 6303\begin_inset LatexCommand \label{sub:DelayedInsFAQ}
6115 6304
@@ -6165,6 +6354,12 @@ As of MySQL version 3.23.52, the error return functions disagree after a failed
6165 tell if anything went wrong with a delayed insert. 6354 tell if anything went wrong with a delayed insert.
6166\layout Standard 6355\layout Standard
6167 6356
6357Instead of delayed inserts, you may wish to utilize InnoDB tables (instead
6358 of the standard MyISAM tables).
6359 InnoDB tables suppot row-level locking and are recommended for high-volume
6360 databases.
6361\layout Standard
6362
6168If after understanding these problems you still wish to enable delayed inserts, 6363If after understanding these problems you still wish to enable delayed inserts,
6169 section 6364 section
6170\begin_inset LatexCommand \ref{sub:DelayedIns} 6365\begin_inset LatexCommand \ref{sub:DelayedIns}