-
MySQL Fast Bulk Inserts
Posted on June 15th, 2010 No commentsThis post will be very short, i just will share a command to enable MySQL to make fast bulk inserts on MyISAM tables.
In some tables that you need to insert a lot of data, exists a right technique to do that.
- Befor starting the inserts go to mysql > alter table target_table disable keys;
This command above will disable all indexs updates during the inserts, that speeds up the insert operation, after you end inserting all data you need to recreate does indexes typing the following command mysql > alter table target_table enable keys;
Easy? Yeah. This command had helped me a lot, as i manipulate a lot of data, millions and millions of rows this is very useful and the gains are in hours, now i have more time to see Brazil playing on the World Cup.
-
Choosing a Good Web Hosting provider
Posted on November 23rd, 2009 No commentsChoosing a Good Web Hosting provider is important to keeping your website open and your costs down. There are many to choose from, as well as different pricing plans to look over. Depending on the amount of sites that you intend on building, you may want to consider a larger web space in the long run.
You should start with the smallest web space that you can get to test the waters, just incase niche website Internet marketing does not work out for you. You may want to add on later, so make sure that your provider offers that option.
You will want to choose a provider that has a reliable service. If your site is down or takes to long to open up when visitors are trying to get in, it may lead them to click out of your site and move on to the next one. They will also more than likely not visit in the future since they will remember their bad experience. For this reason, it is probably best to stick with a well known company who you can check reliable references on. There are many small hosting providers that offer space for as low as $.50 to $1 per month, however, you never know what you will be getting and many of them want you to pay for at least a years worth in advance.
You will also want one that has the most affordable hosting. If you can create your own small site or have one made for you, then you will probably be able to find space for as low as $3 to $4 per month. However, if you need to choose a company that offers a What You See Is What You Get (WYSIWYG) website builder, then you will probably end up paying $10 to $15 per month for the smallest amount of space. But if this is the only way that you can build a site, then it is necessary.
Some web hosting providers may also offer a deal on a yearly URL or other products when you make a web hosting purchase.
Ultimately, whatever web hosting provider you choose will depend on your individual needs and what you can afford. Hopefully you will be able to snap up a well known provider at a low price who will allow you to upgrade your service as needed.
-
Installing lighttpd 1.4.22 as static file server running by proxy with Apache 2.2.3
Posted on March 21st, 2009 No commentsIn this tutorial i will show how i have installed my lighttpd to run side by side with my Apache installation.
First of all let me introduce both, Apache i suppose that everyone nows, its one of the most stable, secure and used web server on the market. Lighttpd is growing, lighttpd is getting famous by the his speed, if look for benchmarks in google you will see that . What a lot of webmasters are doing now is let Apache run the script part, the complicated part, and configuring lighttpd as a static file server, a server for .js, .gif, .jpg, .css this type of files, www.gwebtools.com is running this way the website speed had increased a lot.
I am running on CentOS
Installing and configuring lighttpd
- wget http://www.lighttpd.net/download/lighttpd-1.4.22.tar.gz
- gunzip lighttpd-1.4.22.tar.gz
- tar -xvf lighttpd-1.4.22.tar
- Inside the lighttpd folder run ./configure maybe you get some dependencies errors so you will need to download it with yum install “dependencie-lib”
- make all && make install
- if you get no errors still here, type the command lighttpd and you will get some message like this 2009-03-21 09:33:34: (server.c.552) No configuration available. Try using -f option.
- Now its time to create your lighttpd.conf file, type mkdir /etc/lighttpd, after that inside your lighttpd folder type cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
- Ok, now you have a default conf file, you just need to change the default port of the lighttpd web server.
- Set server.port = 81, this is necessary because apache already runs on port 80, see the log path to see if they are right for your *nix distribution
- Set server.document-root = “Your www folder”, in my case /var/www/vhosts/gwebtools.com/httpdocs
- Now start the lighttpd server running lighttpd -f /etc/lighttpd/lighttpd.conf
Configuring apache to run on proxy mod
- Enable mod proxy on httpd.conf,
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so - In your virtual host config you need to edit conforming your needs, for this blog.gwebtools.com that is running with wordpress i do the following
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /wp-content http://0.0.0.0:81/wordpress/wp-content
ProxyPass /wp-includes http://0.0.0.0:81/wordpress/wp-includes
ProxyPassReverse / http://0.0.0.0:81/ - Now every request to static files, js, images from my blog, lighttpd will be the server how will attend to the request.
- Now everything is running fine and faster.
Creating a script file to manage lighttpd process
#!/bin/sh # Author: Nathaniel Brown # Date: December 16, 2005 # URL: http://nshb.net/lighttpd-restart-script.html # Version: 1.0 # License: MIT #Binary Paths CAT="/bin/cat" PS="/bin/ps" HTTPD="/usr/local/sbin/lighttpd" # Modifiy this line for each install PATH="/etc/lighttpd/" LIGHTTPD_CONF=$PATH"lighttpd.conf" PIDFILE="/var/run/lighttpd.pid" PID=0 if [ -e $PIDFILE ]; then PID=`$CAT $PIDFILE` if [ "x" == "x$PID" ]; then PID=0 fi fi case "$1" in start) if [ 0 -ne $PID ]; then running=`$PS --pid $PID | grep $PID` if [ $running ]; then echo "lighttpd is already running" exit 1 fi rm $PIDFILE PID=0 fi $HTTPD -f $LIGHTTPD_CONF ;; stop) if [ 0 -eq $PID ]; then echo "lighttpd was not running" exit 1 fi kill $PID tries="" while [ -e $PIDFILE ]; do if [ "x$tries" == "x.........." ]; then break fi sleep 2 tries=".$tries" done if [ -e $PIDFILE ]; then echo "lighttpd did not go gentle into that good night, murdering" kill -9 $PID rm $PIDFILE fi ;; restart) $0 stop $0 start ;; reload) if [ 0 -eq $PID ]; then echo "lighttpd was not running" fi kill -HUP $PID ;; status) if [ 0 -eq $PID ]; then echo "lighttpd is not running" fi if [ 0 -ne $PID ]; then echo "lighttpd (pid $PID) is running..." fi ;; *) echo "Usage: "`basename $0`" (start|stop|restart|reload|status)" exit 1 ;; esac
