Archive for April 2009
ab from apache (ARABIC)
إختبر قدرة و سرعة موقعك (او مدونتك)

by JOHNNIE W@LKER (and these are only the test servers)
السلام عليكم و رحمة الله و بركاته…
معظم من يقرء هذا الموضوع يعلم أن المواقع التي يراها على الإنترنت ماهي إلا ملفات ترسل الى متصفحك من قبل برنامج يسمى ال”سرفر”(server)، و الذي يختلف عن الجهاز الذي يعمل عليه (ايضا يسمى “سرفر”).
هناك عدة انواع من برامج السرفرات، ولعل ابرزها:
ا- اباشي (Apache): من أشهر و أفضل برامج “سرفر” في العالم
ب- مايكروسوفت IIS: بصراحه، ليست لدي أي فكره عن سبب إستخدامه حيث أن Apache افضل منه و أرخص (مجاني)
البرنامج الذي يتناوله هذا الموضوع أحد البرامج المدرجة مع اباشي ويسمى ب”ab”. هذا البرنامج يقوم بمحاكاة زوار المواقع حيث يقوم بدخول الى الموقع المراد إختباره كزائر طبيعي (لا يوجد فرق بين نوع السيرفر المراد إختباره، فab يعمل مع جميع أنواع سيرفرات HTTP). و يمكنه محاكات مستخدم واحد او الف مستخدم. و يلي نموذج لهذا (10 مستخدمين و 1000 طلب (request)):
Server Software: Apache/2.2.11
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 14593 bytes
Concurrency Level: 10
Time taken for tests: 0.849 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 14942826 bytes
HTML transferred: 14622186 bytes
Requests per second: 1178.15 [#/sec] (mean)
Time per request: 8.488 [ms] (mean)
Time per request: 0.849 [ms] (mean, across all concurrent requests)
Transfer rate: 17192.28 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 3 2.3 3 16
Processing: 1 5 17.6 3 209
Waiting: 0 4 16.1 2 207
Total: 3 8 17.6 6 210
Percentage of the requests served within a certain time (ms)
50% 6
66% 6
75% 7
80% 7
90% 8
95% 17
98% 19
99% 159
100% 210 (longest request)
في المثال السابق يمكن معرف سرعة النقل (17192.28 Kbytes/sec (لأنه localhost)) و معدل الزوار بالثانية (1178.15).
لتنزيل البرنامج، يمكنك زيارة http://www.apache.org. اذا كنت تستخدم أوبونتو، اكتب
sudo apt-get install apache2-utils
في Terminal.
لإستخدامه أكتب
ab -c م -n ع http://www.شيء.com:80/
حيث أن “م” تمثل عدد المتخدمين و “ع” تمثل عدد الطلبات و شيء يمثل الموقع/المدونة المراد إختبارها. يلي مثال بسيط على هذا:
ab -c 1 -n 100 http://araby.com:80/
سيقوم بإختبار http://araby.com كمستخدم واحد خلال عشر طلبات
أختم بالقول ان هذه الأدة مفيده ولكن يرجى إستخدامها لتجريب مواقعكم الخاصة وليس على مواقع الغير لأنها قد تستهلك سرعة السرفر في الرد على الاخرين.
و السلام عليكم و رحمة الله و بركاته
SIGTERMer
See how fast your server/webhost really is!
as i wait for my boss to show up, i’ll write this nice little post about a tool I “discovered” today.
Most of you have probably heard of apache. one tool that comes with it is a benchmarking tool called ab. this tool can be used to preform benchmark tests on any HTTP server (not only apache) and supports a whole bunch of options. most of these options are for special cases, but for a basic setup (99.999999% of the web’s servers*) the following command is all you need:
ab -c [Number of users] -n [Number of requests] http://[domain]:[port]/
where
Number of users: the number of concurrent users the tool should simulate.
Number of requests: the number of requests ab should generate.
Domain: sites domain e.g. example.com
port: normally 80, sometimes 8080. can be something else
this can be used to benchmark local and remote servers. i have posted the output of ab after a ran it to test my server (ab -c 10 -n 1000 http://localhost:80/):
Server Software: Apache/2.2.11
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 14593 bytes
Concurrency Level: 10
Time taken for tests: 0.849 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 14942826 bytes
HTML transferred: 14622186 bytes
Requests per second: 1178.15 [#/sec] (mean)
Time per request: 8.488 [ms] (mean)
Time per request: 0.849 [ms] (mean, across all concurrent requests)
Transfer rate: 17192.28 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 3 2.3 3 16
Processing: 1 5 17.6 3 209
Waiting: 0 4 16.1 2 207
Total: 3 8 17.6 6 210
Percentage of the requests served within a certain time (ms)
50% 6
66% 6
75% 7
80% 7
90% 8
95% 17
98% 19
99% 159
100% 210 (longest request)
as you can see, apache -on the same system- can handle 1178.15 users per second at 17192.28 Kbytes/sec (i wouldn’t mind having that kind of internet speed)
now, lets test a remote server (microsoft.com for example, i’m sure they won’t mind the extra load). [ab -c 10 -n 1000 http://microsoft:80/]
Server Software: Microsoft-IIS/6.0
Server Hostname: microsoft.com
Server Port: 80
Document Path: /
Document Length: 0 bytes
Concurrency Level: 10
Time taken for tests: 101.323 seconds
Complete requests: 1000
Failed requests: 2
(Connect: 0, Receive: 1, Length: 0, Exceptions: 1)
Write errors: 0
Non-2xx responses: 999
Total transferred: 423576 bytes
HTML transferred: 0 bytes
Requests per second: 9.87 [#/sec] (mean)
Time per request: 1013.227 [ms] (mean)
Time per request: 101.323 [ms] (mean, across all concurrent requests)
Transfer rate: 4.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 13 26 14.4 19 83
Processing: 647 775 1138.3 663 30042
Waiting: 0 743 661.9 661 6704
Total: 664 800 1139.1 684 30060
Percentage of the requests served within a certain time (ms)
50% 684
66% 694
75% 705
80% 711
90% 737
95% 752
98% 776
99% 6676
100% 30060 (longest request)
This benchmark isn’t as accurate as the previous one. (microsoft keeps closing the connection. the first time it did it after 800 req.s the second time it closed it after 400 req.s i had to force it using the -r option to get the full 1000 requests).
microsoft (at the time of this test) can serve up to 9.8 users per second. epic slug.
ab also has the abilty to gennerate plotting data, but i don’t have time to get into this right now. see ya.
SIGTERMer
___
* this number might not be accurate
Google Images – a new option
Google Image Search engine has been recently upgraded; adding a new option for searching images(other than image sizes selection and the faces/photo/line-drawing selection) … they’ve added a color selection; meaning when you want to search for images, you can specify the color of an image (of course not a full image of a single color, cuz that’ll be dumb!! ). And by ” you can specify the color of an image” i mean: to choose the (majority) color in a single image, this might be helpful a lot! … I know you wouldn’t understand until you see an example, here look below,
as you can see, yes you can select a color (Red/Orange/Yello/Green/teal/blue/purple/pink/white/gray/black/brown), you might be saying right now “and how would that help?” the answer is the following example: if you wanted a picture of a mother board, not any color, you need a BLUE one (click here). another examples for gamers, hmmm …a GREEN PS3?!
See this will help; instead of clicking on “Next page” till you fnd the wanted color, you can easily do this! simple eh?!
Enjoy Gooooooooooogling images!
Anxious Nut
Documenting your projects with DOCBOOK
click on three links bellow then click around:
bash
secure programming
Docbook
if you did click around, you would have probably noticed something; all the documents are presented in a consistent way even though they where written by deferent people, living in deferent places.
if you were adventurous, and went up a few directories you might have noticed that each document had a pdf version, and that each pdf of the three was organized in the same way as the other.
can it be that each writer thinks in the exact same way? i think not.. at least i hope not.
the tool behind producing these online/offline documents is ether Docbook or LaTex. this article discusses Docbook, an schema (XML or SGML) developed to facilitate documenting software or hardware. However, it is not limited to these two fields. in fact, it can be used to document anything.
Docbook focuses on content structure rather then appearance. this – in my opinion – is what makes Docbook so great. instead of using open office and constantly indenting, changing fonts, spacing paragraphs, and so on, i can focus on what is more important: what i’m actually writing!
the following docbook code:
<book>
<bookinfo>
<title>My software is the COOLEST</title>
<authorgroup>
<author>
<firstname>Sulaiman</firstname>
<othername>A.</othername>
<surname>Mustafa</surname>
</author>
</authorgroup>
</bookinfo>
<chapter id="Introduction">
<title>Introduction: Installing and Starting</title>
<para>
This program is written in python and requires a python iterpitor along
with the standared module library to run. the version used is 2.6.1, and
other versions might not be compatable. to istall simply copy the archive to the desired directory. to start the program, you have two
options; first, you can start the script directly by issuing the following command:
(while in the same directory)
<example>
<title> Starting the program </title>
<programlisting>
./ConfParse.py
</programlisting>
</example>
of course youm may also start it by suppling it as an agument to a pthon interptor.
<warning><para>This software was written with python 2.6.1, using ether older versions or newer ones might <emphasis>break</emphasis> the program!</para></warning>
</para>
</chapter>
</book>
should give:

note that docbook can save in many deferent styles and formats. for more information, you may want to look at this.
SIGTERMer
Sun Set pictures
I only caught 2 photos
this is one of the sun set images if you would like to see more of my photos click on the link it will lead you to my Gallery here’s the link:
http://www.flickr.com/photos/bone-crusher/
BONE-CRUSHER
a .net.kw domain for 120$ and that’s not all!
Kuwait has some of the weirdest rules on the planet, i’ll give you that.
most of them don’t even make sense, but 120$ for a domain name is profoundly wrong.
I was assigned the task of starting up and maintaining the offical AAO site (don’t worry, this blog will remain the main one). while searching for domain names for the site, i thought of .kw. i mean come on, what better way to promote kuwait and our selfs as kuwaities then a .kw domain. so i dropped by http://www.kw. i was stunned when i saw this:

www.kw
being desperate not to get an online banking account, i conveniently developed amnesia, and continued on reading. reading more, i discovered that i – as a person – am not entitled to get anything except a .net.kw. (i had my eyes on .kw or .org.kw)
developed amnesia again, and continued on reading. the third “rule” did it where it stated that the registration must be done through one of our half dozen ISPs. if you live in kuwait you would know that here, you would need to pay about 60$ per month for a 256kbps connection. i might be able to afford forking 120$ every two years, but the is NO WAY i’m going to pay for a static ip with a decent connection(> 1Mbps). it’ll cost me at least 5 times the amount (300$ per month without registration fees). i was intending on using FreeDNS name servers which is free and no limits are imposed.
I would just like to say that kuwait should be more open like Tokelau (www.tk) when it comes to domain registration or at least like normal 9.99$/year domains out there.
SIGTERMer
CC ROCKS!
once again, creative commons saves the day!
a couple of hours ago, i needed a simple map of earth’s surface for AAO’s new website to facilitate selecting interface language. the first thing that came to mind was google maps. but if i’m not mistaken, the maps are copyrighted.
so i searched cc content, and to my surprise, i found exactly what i was searching for and it was released in the public domain!

the result (with some openGL and GIMP magic):

I usually release everything under ether GPL (for software) or CC (for media), but media might be going to more public places soon.
everyone listen up: if you can license there work under open licenses or release it into the public domain, please do so. the globe would have taken me a lot longer to finish if i had to draw the continents by hand. and i’m sure there a lot cases like this one happening daily.
Open Content is the Future! please keep up!
SIGTERMer
wget: more versatile then a trusty swiss-army knife

A tool that makes life that much easer…
This is by far the most useful command-line tool when it comes to dealing with the web. wget is a small simple-to-use tool that allows you to get content from other sites. this includes html, tar balls, and anything else the server is willing to provide.
if you’re wandering what good it is when there are numerus browsers that do this, read on.
wget (unlike browsers) is a non-interactive tool, meaning it doesn’t need you once it has been given a job. such as downloading an entire directory, say this one. rather than clicking each item on that list, you can simply use wget by issuing this command:
wget -r ftp://ftp.geda.seul.org/pub/geda/release/v1.4
wget can also help by making those pesky online-only documents available off-line. take this for example (i know this is available in downloadable form but this method is applicable on other sites as well)
wget is a well-behaved tool, it will not download from any site that specifies rules prohibiting it. these rules are stored in the root directory of the server (robots.txt). however, most rules are meant to be broken. you can ignore rules by adding the following to the command:
-e robots=off --wait 1
The “wait” has nothing to do with ignoring rules, it simply makes it easer on the server by waiting 1 second between every fetch. please add this when downloading from good sites, and conveniently forget it when downloading from microsoft :p
Also, when recursing, wget will only go down 5 levels. if the site you want to download has a directory structure that goes deeper then this, add
- l
Finally, some sites analyze traffic and can determine if an automated application such as wget is downloading, and can block it. there is an solution to this but i won’t go into it since i never really used it.
enjoy the web with wget
SIGTERMer
SONIC THE HEDGEHOG: a glitch among many
SIGTERMer
Software Review: TVQuran – An Outstanding Online Quran Player
TVQuran is an amazing service that aims to stream audio Quran content online. although there are countless sites that do the same thing, TVquran is the first one to provide a small high quality script to embed the player in other sites. it offers a wide range of “mashay5″ as well.

The following is the code for embedding the player in your webpage (in the voice of mohammed ayob).
<center><iframe align="center" id="IW_frame_1438" src="http://www.tvquran.com/add/Ayyub.htm" frameborder="0" allowtransparency="1" scrolling="no" width="302" height="334"></iframe></center>
please remember that the quran is not something you listen to on the side, so please specify a special page for it
if you don’t own a site and still want to benifit from the service, you can go directly to www.tvquran.com/ or you can copy the following code and paste it into a local file. keep in mind that you must specify the “.html” extension unless your system can figure it out by itself.
<head>
<body>
<center><iframe align="center" id="IW_frame_1438" src="http://www.tvquran.com/add/Ayyub.htm" frameborder="0" allowtransparency="1" scrolling="no" width="302" height="334"></iframe></center>
</body>
</head>
one note though, it shouldn’t start by default. other than that it’s a great project. remember to pass this on to everyone you know, that’s how it got to me…
SIGTERMer



