Month: September 2008

  • jQuery.com down or super slow

    Anyone knows a downloadable documentation for jQuery. Their site is so slow that makes referencing impossible. This is an recurring issue that has happened for quite a few months. Is the traffic too much for them to handle?

  • jQuery not selecting nested elements

    For a jQuery newbie, I was unsure how to only select the TR’s of the main table and not TR’s within sub-tables. Tried this that (children(), siblings()) and a bunch of selectors and found out the easy way (‘#mytable > tbody > tr’) How easy! 🙂

  • Improve security for apc.php

    If you’re running APC with PHP, you have the option to download apc.php to view, monitor the usage/stats. However, the default authentication is very open. Without any credential, anyone can view the running stats and also the cached filenames (a simple search on “APC INFO” will show some site running APC). The login is to…

  • pecl and memory limit error

    If you run “pecl install [something]” and get this error: “Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate xxx bytes)”, you want to change “/usr/bin/pecl” (or run “locate pecl” to see where it is) and specify a larger memory limit. #!/bin/sh exec /usr/bin/php -C -n -q -d include_path=/usr/share/pear \ -d output_buffering=1…

  • ip_conntrack and dropped packets

    For busy servers, ip_conntrack can fill up quickly and must be monitored or you will get intermittent packet drops. Check var/log/messages for these error messages. Couple values can be adjusted to the kernel: more /proc/sys/net/ipv4/netfilter/ip_conntrack_count more /proc/sys/net/ipv4/netfilter/ip_conntrack_max => count should be less than max, if it’s near the maximum value, increase max more /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established =>…

  • mod_deflate bug

    Hmm, another day, another bug: #33499. This time it is mod_deflate and PHP don’t play well together. PHP makes a GIF/JPG file and yet mod_deflate still compress it. Solution: use mod_filter (which only available from 2.1), or disable Apache’s compression for PHP files and let PHP do the compression via ob_start(‘ob_gzhandler’);

  • Get network stats for RRD graphing

    This snippet displays Active, Passive and Established connections reported by “netstat –statistics” for saving into RRD or other monitoring tools.

  • Apache versus lighttpd

    Both run on the same server: Apache/2.0.59 (port 80) & lighttpd 1.4.19 (port 8080). 2 tests: dynamic & static files. To make things a little realistic, it’s from a EU client to a US server. Serving a dynamic file eu$ ab -n 1000 -c 10 “http://us.server/run-some-sql.php” Server Software: Apache Server Port: 80 Document Length: 824…

  • Counting TIME_WAIT with netstat

    # netstat -tan | grep ‘:80 ‘ | awk ‘{print $6}’ | sort | uniq -c Sample Output: 15 CLOSING 26 ESTABLISHED 31 FIN_WAIT1 7 FIN_WAIT2 14 LAST_ACK 2 LISTEN 24 SYN_RECV 2428 TIME_WAIT

  • Qcache_not_cached should be small

    If not, you’re wasting overhead on checking and invalidating the query cache, for a large/busy query cache, it gets more expensive. Thus, the lesson is to know which query should not be cached and explicitly use “SELECT SQL_NO_CACHE …” in your SQL statement. It means tables with many UPDATES/INSERTS should not use query caching.