logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Need some advice on Apache 2.2.4 PHP 5.2.3 MYSQL 4.0.26
Author
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Fri 13 Jul '07 17:15    Post subject: Need some advice on Apache 2.2.4 PHP 5.2.3 MYSQL 4.0.26 Reply with quote

Hi all,

I use:

Apache 2.2.4 (httpd-2.2.4-win32-x86-ssl.zip Steffen Build) PHP 5.2.3 MYSQL 4.0.26 Win32 Windows XP SP2 2GB RAM

Wonderful forum i must say! I have a preformance issue that is clearly related to apache, and i can not figure out how to cure it. For some reason when i get some load on my apache it toally stops processing thumbnails and pictures and start running extreamly slow. It once generated a error message in my error.log looking like this:

Code:
[Fri Jul 13 13:57:43 2007] [crit] [Fri Jul 13 13:57:43 2007] file .\\server\\mpm\\winnt\\child.c, line 1120, assertion "(rv >= 0) && (rv < threads_created)" failed


But that was when i used php5_module "php5apache2_2.dll"

Now im testing FastCGI and ive not been able to generate this error message but i still get slow loading on thumbnails and pictures once i start get some load. (When i say "some load" i mean about 5-10 people browsing so its not alot of people)

Ive read that ThreadsPerChild can be the issue, but ive tested several of values between 50 to 1024 without sucess.

One thing is for sure it is a apache issue, ive benchmarked the sql and i never have any slow queries, php is running fine with both module_5 and fast cgi.

What have i missed, ive actually googled "Optimize apache 2.2" and done what ive found but i might have missed something crucial?!

Thanks in advance!

EDIT: Heres a image how the issue might look, took this today when i got this error message.

http://dkeserver.mine.nu/stuff/exampleofissue.jpg

ive asked the devs of "coppermine gallery" and this issue is not related to their gallery, they also claim its apache!
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 13 Jul '07 18:51    Post subject: Reply with quote

The "line 1120, assertion ..." message should only happen during Apache shutdown if all the threads cannot terminate within 3 minutes.
It should have been preceded by a message like: "Child PID: Waiting for NNN worker threads to exit."
and followed by a message like "Child PID: Terminating NNN threads that failed to exit."

Maybe Apache is restarting unexpectedly.

A useful test is to run the Windows Task Manager - [Ctrl-Shift-Esc] and choose the [Processes] tab
then watch the httpd, the php-cgi, and (if you run MySQL on the same computer) the mysql* processes.

The CPU column may tell you which process is really busy, and if the PID for one of the two httpd processes changes you will know that Apache is restarting.

-tom-
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Fri 13 Jul '07 19:00    Post subject: Reply with quote

Ahh i didn't realize that the message was related to shutdown of apache. I did shutdown apache when i wasn't able to browse my page for 1 minute, a restart fixed it.

But i have been monitoring cpu usage in taskmanager while this error has occured and its not a cpu issue as i have 0% load when it occurs, it must be apache that blocks incoming requests and put them in a large queue which is getting worked off SLOWLY.

Is there any good and simple way to see when these childthreads are all used and theres a big queue of requests building up in a gui or a logfile?

Ive backed to apache 2.0.55 with module_5 atm as i had some trouble getting "amapche" to work with fastcgi, but i really didnt notice any preformance difference using 2.2.4.

Its very hard for me to actually see if any setting changes anything as it happens randomly often when i have load, but i dont often have it so it can be a week before the problem occurs which making it painfully hard to search for where the problem lays.

Thanks for the feedback!
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 13 Jul '07 20:34    Post subject: Reply with quote

You could enable mod_status to see the active requests in Apache when the problem occurs.

Be sure to put some restrictions on /server-status (for example: Allow and Deny) so only you can monitor your Apache server.

Your problem may be a network problem rather than an Apache problem, or something is running very slow in PHP.
Slow delivery of thumbnails and pictures is not a very common Apache problem, even with many (e.g. hundreds or thousands) of users.
If Apache is not using any CPU, it is unlikely that Apache is the root cause of your slowdown.

-tom-
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Fri 13 Jul '07 20:39    Post subject: Reply with quote

Roger that!

Thanks alot for the tips, i will check this out and investigate! ill be back!

Thanks again
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Fri 13 Jul '07 21:15    Post subject: Reply with quote

K ive installed the module, very nice thanks for the tip! it dosnt seem to have anything to do with ThreadsPerChild, as i have lots over when this seems to happen.

My guess is that its php related then, but what in php can be causing this? I mean ive tested both 5.1.4 5.2.3 and tested with fastcgi and no difference, anyone else had any issues like this?

EDIT: Testing latest mysql build, i noticed by changing some of the settings the queries became much faster, any optimized settings i should look for or tips you could share?
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sat 14 Jul '07 0:35    Post subject: Reply with quote

It's difficult to give "generic" MySQL tuning tips without knowing exactly what your application does.
If there were options to make MySQL go faster for all applications, they would probably be the defaults.

If "amapche" means Ampache, and you think this is what is causing MySQL performance problems,
then you could check that you have the latest version - Ampache 3.3.3.4.

The best performance increases usually come from discovering what data you retrieve from a table, what fields are in the WHERE clause - and making sure that there is an index on the table which lets MySQL retrieve this data quickly based on these fields.

-tom-
Back to top
bentogoa



Joined: 09 Feb 2007
Posts: 66
Location: GOA

PostPosted: Sun 15 Jul '07 8:38    Post subject: Reply with quote

Try Downloading the latest version php_gd2.dll for your version of php

Bento Fernandes
http://www.goanwap.com
Webmaster
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Sun 15 Jul '07 23:44    Post subject: Reply with quote

thanks for the tip bentogoa will try it.

also in the meantime id though id post my sql status log from when i had high load problems, maybe you experts can see somthing wrong in it?

Code:
mysql> show status;
+-----------------------------------+-----------+
| Variable_name                     | Value     |
+-----------------------------------+-----------+
| Aborted_clients                   | 0         |
| Aborted_connects                  | 0         |
| Binlog_cache_disk_use             | 0         |
| Binlog_cache_use                  | 0         |
| Bytes_received                    | 115       |
| Bytes_sent                        | 184       |
| Com_admin_commands                | 0         |
| Com_alter_db                      | 0         |
| Com_alter_table                   | 0         |
| Com_analyze                       | 0         |
| Com_backup_table                  | 0         |
| Com_begin                         | 0         |
| Com_call_procedure                | 0         |
| Com_change_db                     | 0         |
| Com_change_master                 | 0         |
| Com_check                         | 0         |
| Com_checksum                      | 0         |
| Com_commit                        | 0         |
| Com_create_db                     | 0         |
| Com_create_function               | 0         |
| Com_create_index                  | 0         |
| Com_create_table                  | 0         |
| Com_create_user                   | 0         |
| Com_dealloc_sql                   | 0         |
| Com_delete                        | 0         |
| Com_delete_multi                  | 0         |
| Com_do                            | 0         |
| Com_drop_db                       | 0         |
| Com_drop_function                 | 0         |
| Com_drop_index                    | 0         |
| Com_drop_table                    | 0         |
| Com_drop_user                     | 0         |
| Com_execute_sql                   | 0         |
| Com_flush                         | 0         |
| Com_grant                         | 0         |
| Com_ha_close                      | 0         |
| Com_ha_open                       | 0         |
| Com_ha_read                       | 0         |
| Com_help                          | 0         |
| Com_insert                        | 0         |
| Com_insert_select                 | 0         |
| Com_kill                          | 0         |
| Com_load                          | 0         |
| Com_load_master_data              | 0         |
| Com_load_master_table             | 0         |
| Com_lock_tables                   | 0         |
| Com_optimize                      | 0         |
| Com_preload_keys                  | 0         |
| Com_prepare_sql                   | 0         |
| Com_purge                         | 0         |
| Com_purge_before_date             | 0         |
| Com_rename_table                  | 0         |
| Com_repair                        | 0         |
| Com_replace                       | 0         |
| Com_replace_select                | 0         |
| Com_reset                         | 0         |
| Com_restore_table                 | 0         |
| Com_revoke                        | 0         |
| Com_revoke_all                    | 0         |
| Com_rollback                      | 0         |
| Com_savepoint                     | 0         |
| Com_select                        | 1         |
| Com_set_option                    | 0         |
| Com_show_binlog_events            | 0         |
| Com_show_binlogs                  | 0         |
| Com_show_charsets                 | 0         |
| Com_show_collations               | 0         |
| Com_show_column_types             | 0         |
| Com_show_create_db                | 0         |
| Com_show_create_table             | 0         |
| Com_show_databases                | 0         |
| Com_show_errors                   | 0         |
| Com_show_fields                   | 0         |
| Com_show_grants                   | 0         |
| Com_show_innodb_status            | 0         |
| Com_show_keys                     | 0         |
| Com_show_logs                     | 0         |
| Com_show_master_status            | 0         |
| Com_show_ndb_status               | 0         |
| Com_show_new_master               | 0         |
| Com_show_open_tables              | 0         |
| Com_show_privileges               | 0         |
| Com_show_processlist              | 0         |
| Com_show_slave_hosts              | 0         |
| Com_show_slave_status             | 0         |
| Com_show_status                   | 1         |
| Com_show_storage_engines          | 0         |
| Com_show_tables                   | 0         |
| Com_show_triggers                 | 0         |
| Com_show_variables                | 0         |
| Com_show_warnings                 | 0         |
| Com_slave_start                   | 0         |
| Com_slave_stop                    | 0         |
| Com_stmt_close                    | 0         |
| Com_stmt_execute                  | 0         |
| Com_stmt_fetch                    | 0         |
| Com_stmt_prepare                  | 0         |
| Com_stmt_reset                    | 0         |
| Com_stmt_send_long_data           | 0         |
| Com_truncate                      | 0         |
| Com_unlock_tables                 | 0         |
| Com_update                        | 0         |
| Com_update_multi                  | 0         |
| Com_xa_commit                     | 0         |
| Com_xa_end                        | 0         |
| Com_xa_prepare                    | 0         |
| Com_xa_recover                    | 0         |
| Com_xa_rollback                   | 0         |
| Com_xa_start                      | 0         |
| Compression                       | OFF       |
| Connections                       | 3233      |
| Created_tmp_disk_tables           | 0         |
| Created_tmp_files                 | 132       |
| Created_tmp_tables                | 1         |
| Delayed_errors                    | 0         |
| Delayed_insert_threads            | 0         |
| Delayed_writes                    | 0         |
| Flush_commands                    | 1         |
| Handler_commit                    | 0         |
| Handler_delete                    | 0         |
| Handler_discover                  | 0         |
| Handler_prepare                   | 0         |
| Handler_read_first                | 0         |
| Handler_read_key                  | 0         |
| Handler_read_next                 | 0         |
| Handler_read_prev                 | 0         |
| Handler_read_rnd                  | 0         |
| Handler_read_rnd_next             | 0         |
| Handler_rollback                  | 0         |
| Handler_savepoint                 | 0         |
| Handler_savepoint_rollback        | 0         |
| Handler_update                    | 0         |
| Handler_write                     | 132       |
| Innodb_buffer_pool_pages_data     | 0         |
| Innodb_buffer_pool_pages_dirty    | 0         |
| Innodb_buffer_pool_pages_flushed  | 0         |
| Innodb_buffer_pool_pages_free     | 0         |
| Innodb_buffer_pool_pages_latched  | 0         |
| Innodb_buffer_pool_pages_misc     | 0         |
| Innodb_buffer_pool_pages_total    | 0         |
| Innodb_buffer_pool_read_ahead_rnd | 0         |
| Innodb_buffer_pool_read_ahead_seq | 0         |
| Innodb_buffer_pool_read_requests  | 0         |
| Innodb_buffer_pool_reads          | 0         |
| Innodb_buffer_pool_wait_free      | 0         |
| Innodb_buffer_pool_write_requests | 0         |
| Innodb_data_fsyncs                | 0         |
| Innodb_data_pending_fsyncs        | 0         |
| Innodb_data_pending_reads         | 0         |
| Innodb_data_pending_writes        | 0         |
| Innodb_data_read                  | 0         |
| Innodb_data_reads                 | 0         |
| Innodb_data_writes                | 0         |
| Innodb_data_written               | 0         |
| Innodb_dblwr_pages_written        | 0         |
| Innodb_dblwr_writes               | 0         |
| Innodb_log_waits                  | 0         |
| Innodb_log_write_requests         | 0         |
| Innodb_log_writes                 | 0         |
| Innodb_os_log_fsyncs              | 0         |
| Innodb_os_log_pending_fsyncs      | 0         |
| Innodb_os_log_pending_writes      | 0         |
| Innodb_os_log_written             | 0         |
| Innodb_page_size                  | 0         |
| Innodb_pages_created              | 0         |
| Innodb_pages_read                 | 0         |
| Innodb_pages_written              | 0         |
| Innodb_row_lock_current_waits     | 0         |
| Innodb_row_lock_time              | 0         |
| Innodb_row_lock_time_avg          | 0         |
| Innodb_row_lock_time_max          | 0         |
| Innodb_row_lock_waits             | 0         |
| Innodb_rows_deleted               | 0         |
| Innodb_rows_inserted              | 0         |
| Innodb_rows_read                  | 0         |
| Innodb_rows_updated               | 0         |
| Key_blocks_not_flushed            | 0         |
| Key_blocks_unused                 | 458547    |
| Key_blocks_used                   | 807       |
| Key_read_requests                 | 1370841   |
| Key_reads                         | 8764      |
| Key_write_requests                | 6677      |
| Key_writes                        | 4586      |
| Last_query_cost                   | 0.000000  |
| Max_used_connections              | 9         |
| Not_flushed_delayed_rows          | 0         |
| Open_files                        | 21        |
| Open_streams                      | 0         |
| Open_tables                       | 12        |
| Opened_tables                     | 0         |
| Prepared_stmt_count               | 0         |
| Qcache_free_blocks                | 52        |
| Qcache_free_memory                | 261915472 |
| Qcache_hits                       | 122463    |
| Qcache_inserts                    | 22283     |
| Qcache_lowmem_prunes              | 0         |
| Qcache_not_cached                 | 1670      |
| Qcache_queries_in_cache           | 3290      |
| Qcache_total_blocks               | 6680      |
| Questions                         | 164811    |
| Rpl_status                        | NULL      |
| Select_full_join                  | 0         |
| Select_full_range_join            | 0         |
| Select_range                      | 0         |
| Select_range_check                | 0         |
| Select_scan                       | 1         |
| Slave_open_temp_tables            | 0         |
| Slave_retried_transactions        | 0         |
| Slave_running                     | OFF       |
| Slow_launch_threads               | 0         |
| Slow_queries                      | 0         |
| Sort_merge_passes                 | 0         |
| Sort_range                        | 0         |
| Sort_rows                         | 0         |
| Sort_scan                         | 0         |
| Ssl_accept_renegotiates           | 0         |
| Ssl_accepts                       | 0         |
| Ssl_callback_cache_hits           | 0         |
| Ssl_cipher                        |           |
| Ssl_cipher_list                   |           |
| Ssl_client_connects               | 0         |
| Ssl_connect_renegotiates          | 0         |
| Ssl_ctx_verify_depth              | 0         |
| Ssl_ctx_verify_mode               | 0         |
| Ssl_default_timeout               | 0         |
| Ssl_finished_accepts              | 0         |
| Ssl_finished_connects             | 0         |
| Ssl_session_cache_hits            | 0         |
| Ssl_session_cache_misses          | 0         |
| Ssl_session_cache_mode            | NONE      |
| Ssl_session_cache_overflows       | 0         |
| Ssl_session_cache_size            | 0         |
| Ssl_session_cache_timeouts        | 0         |
| Ssl_sessions_reused               | 0         |
| Ssl_used_session_cache_entries    | 0         |
| Ssl_verify_depth                  | 0         |
| Ssl_verify_mode                   | 0         |
| Ssl_version                       |           |
| Table_locks_immediate             | 36735     |
| Table_locks_waited                | 37        |
| Tc_log_max_pages_used             | 0         |
| Tc_log_page_size                  | 0         |
| Tc_log_page_waits                 | 0         |
| Threads_cached                    | 7         |
| Threads_connected                 | 1         |
| Threads_created                   | 9         |
| Threads_running                   | 1         |
| Uptime                            | 27410     |
| Uptime_since_flush_status         | 27410     |
+-----------------------------------+-----------+
249 rows in set (0.01 sec)

mysql>


Ive also tested to remove Ampache, its not the problem. I only use ampache for my self and 2 other users at the moment, and when i removed it i experienced no difference in the load issue :/
Back to top
bentogoa



Joined: 09 Feb 2007
Posts: 66
Location: GOA

PostPosted: Mon 16 Jul '07 16:41    Post subject: Reply with quote

Key_reads=The number of physical reads of a key block from disk. If Key_reads is big, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as Key_reads/Key_read_requests.

Table_locks_waited=The number of times that a table lock could not be acquired immediately and a wait was needed. If this is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.

Bento Fernandes
Webmaster
http://www.goanwap.com
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Mon 16 Jul '07 18:27    Post subject: Reply with quote

thanks for the reply bentogoa,

dosn't look so bad in sql after all then, how do i preformance check php? i havent really made any preformance checks to apache, ive only applied the server status mod to see how many child threads and such i have used on peaks but its not even 50% of threadsperchild.

I think its somewhere in the querys as i have a image gallery with 8x4 images per page, if 10 users are browsing them it gets up to alot of queries, like 8x4x10.

All i know that its somekind of bottleneck in some setting as my cpu/memory does not peak, neither does my bandwidth..

Ill try setting some more memory for the sql things, any other preformance tip you might recommend its highly welcome, ive heard good things about fastcgi but i didnt really exerience any difference, what might i have done wrong?
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Tue 17 Jul '07 20:21    Post subject: Reply with quote

Ive done some more research and it dosnt seem to be MYSQL issue, its either php or apache, but i cannot see any bottleneck from my server, the cpu load is low, apaches memory load grows ALOT when this happens though, but i cannot see any errors in the logs, it just wont load things fast. PHP I dont know how to check, ive checked the php info when the load was high but i couldnt see anything there.

I have lots of "Threadsperchild" over , ive set it to 150, this happens when i get around 40-50 threads reading.

What do you experts think it is? is it possible to be a hardware issue even though i cannot see any load in taskmgr?

(ive tested to surf my page through "localhost" on the server, and i get the exact same effect, so it cannot be the network card, or my network...)

EDIT: Tested both apache 2.0.54 and the latest 2.2.4 and i must say it goes much much better with 2.0.54, it takes alot more threads to read before it becomes sluggish, takes around 30-50 with 0.54 and like 5-10 with 2.2.4...

Well its pretty obvious that its something with apache, is there any strings to dedicate more ram to apache or anyway for it to stop being such a bottleneck?!?!
Back to top
dke



Joined: 13 Jul 2007
Posts: 61
Location: sweden

PostPosted: Thu 19 Jul '07 10:30    Post subject: Reply with quote

Okey ive almost solved the problem now. The issue was related to a error message from error.log.

I used command : Win32DisableAcceptEx

And it got ALOT better.

However, it seems to be some kind of memory leak somewhere, apache runs smooth and everything is fine and the server can handle alot now, but if apache is constantly getting requests for 10h+ the memory it consumes just keeps on rising, it dosnt seem like it release any of it. When i went to bed last night it was consuming 40mb, when i woke up it was up at 310mb, and still slowly rising.

Any known leaks? Im using apache module 5 to interact with php at the moment, maybe fastcgi is better for this?
Back to top


Reply to topic   Topic: Need some advice on Apache 2.2.4 PHP 5.2.3 MYSQL 4.0.26 View previous topic :: View next topic
Post new topic   Forum Index -> Other Software