LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 08-20-2010, 12:28 AM   #1
koshihaku
Member
 
Registered: Aug 2010
Posts: 50

Rep: Reputation: 0
Question could you please give me some instructions of my experiment?


I am a student and I am doing a experiment for my graduation thesis.

I use two computers, one as server (ubuntu apache), and one as client. On the client, I use httperf and autobench to benchmark the apache server. I want to get the real-time memory used by apache server and analysis them.

Now I have a PROBLEM:
I need to used dynamic content in the requests. I was told that the generation of dynamic content can be achieved through a program built to simulate database accesses and to create HTML pages according to the sizes defined previously e.g. 100kb, 1Mb or 2Mb.

But I am a newbie lack of knowledge of this. Could anybody give my any advices or instruction about this?

How can I achieve this using httperf and autobench?

I am sorry for innocent questions. Thank you very much!
 
Old 08-20-2010, 06:21 AM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 697

Rep: Reputation: 93
If you need to generate dynamic content, the easiest way would be to
install php. With php you can embed code inside html files which will
run every time the pages are opened.
 
1 members found this post helpful.
Old 08-20-2010, 10:44 AM   #3
koshihaku
Member
 
Registered: Aug 2010
Posts: 50

Original Poster
Rep: Reputation: 0
Question

Quote:
Originally Posted by carltm View Post
If you need to generate dynamic content, the easiest way would be to
install php. With php you can embed code inside html files which will
run every time the pages are opened.

Thank you very much!

If I made a html page for example /var/www/html/test.html, do you mean I can make a php code inside the "test.html", and when I do test, I need to send request of "test.html" on the client-side?

And if I make several html pages with different size, I can achieve my requirement?

I have no knowledge of php, is that ok for me to study from zero? If I just learn some basic knowledge, is that enough for this?

Thanks!
 
Old 08-20-2010, 11:39 AM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,010

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Originally Posted by koshihaku View Post
And if I make several html pages with different size, I can achieve my requirement?
that would not qualify as 'dynamic', actually if i were an instructor would probably mark that a fail

Quote:
Originally Posted by koshihaku View Post
If I made a html page for example /var/www/html/test.html, do you mean I can make a php code inside the "test.html", and when I do test, I need to send request of "test.html" on the client-side?
it would be 'test.php' unless you linke the php script in an iframe in 'test.html' or modify the server to execute html documents with the php parser

Quote:
Originally Posted by koshihaku View Post
I have no knowledge of php, is that ok for me to study from zero? If I just learn some basic knowledge, is that enough for this?
that would be up to the instructor but the whole point of getting a degree is learning so i would probably say that is acceptable, you can learn alot from php's website for instance
http://us.php.net/manual/en/function.fgetcsv.php

Quote:
Originally Posted by koshihaku View Post
I need to used dynamic content in the requests. I was told that the generation of dynamic content can be achieved through a program built to simulate database accesses and to create HTML pages according to the sizes defined previously e.g. 100kb, 1Mb or 2Mb.
best way i can think of to simulate database access is with a csv file, (csv files can be created in just about any major spreadsheet program like excell or openoffice.org calc) the above link to php.net should be a starting point on how to parse csv files

i would say to focus on at least a bare minimum the following:

- opening a CSV file for reading/writing (csv as stated is a decent stand in for a database table and can be created easily with a spreadsheet program)

-basic array structure

-a few basic loops (particularly while and foreach to recurse through the rows/columns of a csv file respectively)

-working with superglobals (eg $_GET and $_POST)


the simplest example would be to create an index.php that uses $_GET to specify which 'table' (csv file) to use and generate a simple html <table> structure eg
Code:
http://server/?table=100kb
in the above example 'index.php' is assumed so it would be the equivilent of
Code:
http://server/index.php?table=100kb
would output the contents of 100kb.csv in simple table format

possibly learn the basics how to make http requests with javascript (AJAX)

hope this helps a bit, good luck

Last edited by frieza; 08-20-2010 at 12:11 PM.
 
1 members found this post helpful.
Old 08-20-2010, 04:49 PM   #5
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,010

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
p.s. you could also use a simple for next loop to generate X number random characters (8 bits per char) based on a number of K bytes input
like
Code:
http://server/?kbytes=100
which would be something like
Code:
<?php 
for ($x=1;$x<=(($_GET['kbytes'])*1024)/8);$x++) {
     echo ("b");
}
?>
if course that wouldnt be very impressive and probably not adaquate

Last edited by frieza; 08-20-2010 at 04:52 PM.
 
1 members found this post helpful.
Old 08-23-2010, 08:49 AM   #6
koshihaku
Member
 
Registered: Aug 2010
Posts: 50

Original Poster
Rep: Reputation: 0
Question

Quote:
Originally Posted by frieza View Post
p.s. you could also use a simple for next loop to generate X number random characters (8 bits per char) based on a number of K bytes input
like
Code:
http://server/?kbytes=100
which would be something like
Code:
<?php 
for ($x=1;$x<=(($_GET['kbytes'])*1024)/8);$x++) {
     echo ("b");
}
?>
if course that wouldnt be very impressive and probably not adaquate


Thank you very much!

Do you mean I need to open a csv file with a certain size? If I write that to the php script, does that mean everytime I send request to server, it will generate a csv file with the certain size?
 
Old 09-03-2010, 11:41 AM   #7
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,010

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
the script that you quoted simply generates X kb of the letter b

otherwise yes opening a csv of a certain size and parsing it to a table such as
Code:
<?php
$file=fopen("/path/to/".$_GET['file'].".csv",r);
$output="<table>";
while ($row=fgetcsv($file)) {
     $output.="<tr>";
     foreach($row as $col) {
         $output.="<td>".$col."</td>";
     }
     $output.="</tr>";
}
$output.="</table>";
fclose($file);
echo $output;
when saved as index.php and accessed as
Code:
http://host/?file={filename} (minus the .csv extension and path, is assumed by the program)
should output an html table containing the csv data
the csv files should be created using a spreadsheet and put in a directory readable by your script
hopefully this clear up your confusion

Last edited by frieza; 09-03-2010 at 11:42 AM.
 
1 members found this post helpful.
  


Reply

Tags
apache, server


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PCLinusOS --Give me explicit instructions on installing HP Officejet j5780 Printer Dakota42784 Linux - Newbie 3 04-15-2008 06:15 AM
My experiment dillydobbs LinuxQuestions.org Member Intro 16 10-04-2005 10:06 PM
Psych Experiment jqcaducifer General 3 09-29-2005 01:59 PM
experiment LinuxOnEarth Linux - General 1 11-25-2004 06:22 PM
If possible, could anyone give me exact instructions to dual-boot WinXP and Slackware crumb Linux - General 5 10-16-2003 10:41 PM


All times are GMT -5. The time now is 05:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration