[kdewebdev-webdeveloper] test

Andrew Lowe andrew.lowe at manildra.com.au
Wed Mar 5 17:34:01 EST 2008


On Wed, 5 Mar 2008 23:59:30 Isaak wrote:
> Thank you Andrew, your information is very interesting and helpful.
>
> > The reason I suggest not using AJAX is because some clients will not have
> > JavaScript enabled (Firefox NoScript plugin, or just turned off in the
> > browser).  This is done for security, and probably is a bit paranoid. 
> > Also some mobile devices do not support javascript, or have limited
> > support.  The big one is as you mentioned, search engines.
>
> I don't really take this into account for projects as the one I am
> currently working on. Nowadays people should have JavaScript enabled,
> perhaps not globally (thank you NoScript plugin :)) but at least for the
> websites you give your trust to. I'm sure that every visitor who intends to
> visit my website will enable JavaScript in order to be able to make use of
> the all the features of the website. Those who do not wish to enable
> JavaScript will see a clear message which explains that they have
> JavaScript disabled and enabling it would increase the functionality of the
> website, this message will also include a link to a page where instructions
> are explained on how to enable JavaScript in the most common webbrowsers.
> And what about mobile phone visitors? Well, the website I'm currently
> creatiing will not be compatible with mobile phones, because it doesn't
> have a W at P version of the website and the width and height are way too
> large for mobile phones.
>
> I would take this into account for commercial projects which needs
> compatibilty with all major browsers, whether they have JavaScript or
> images enabled or disabled, or use a different type of monitor.

I see that this is not really important for the current project you are 
working on, but, as you say, you are using this as an experience building 
exercise... so to some degree it is good to do it "correctly" (I believe 
there is no correct way to do anything with web-design - definitely wrong 
ways, but no true right way).

>
> > Using AJAX and XML for the sake of it is not really a good thing to do,
> > as AJAX has its limitations and overhead.  A suggestion if you wanted
> > AJAX usage would be to have your articles displayed with just a title
> > and/or summary and click the article to load via AJAX the full article. 
> > You would probably need to use PHP on the back-end to take the requests
> > and pass back the right data, or you could just load a static XML file
> > for each article.
> > An example would be the Slashdot "New" discussion format - where low
> > rated comments are not displayed until you click the title of that
> > comment, and they are loaded dynamically.
> > AJAX for a static page is probably not the best use of the technology...
>
> I couldn't agree more with your suggestion about loading certain parts of
> the website only when they are being activated or displayed by the visitor,
> but since we're only talking about news messages of a fansite this
> shouldn't be much of a difference so loading the complete XML file wouldn't
> be a problem (dispute the fact that the database would be a much better
> solution for this project), I only use this kind of functionality for
> larger projects.
>
> PHP is much faster than JavaScript since they both are totally different
> scripting languages while the first one is server-side and the second one
> client-side. But the filesystem being much slower than the database made me
> choose for the AJAX solution, and using AJAX would pass most of the load to
> the client's computer instead of the server.

I do not really understand your point that the "filesystem being much slower 
than the database".  This is definitely not true!  If you are reading a 
static file out of the database verses out of a file system, you will get 
much better performance from the filesystem - The database lives on the 
filesystem (well some results may be cached in memory - and some 
databases/table types can be stored in memory - so would be very fast), and 
the record must be found, and returned using either unix socket or network 
socket.  There is much more overhead.  The point that a database becomes more 
efficient is when you want to get only part of the dataset, such as a single 
news article from the database/parsing a comma separated file or xml file.  
Even reading from a SMALL csv file can be faster then a database.

It would be intersting to see which technology would be less load on your 
server in your situation - PHP serving the file from XML or the Database, 
verses a pure AJAX solution.  
I would probably put my money on php being less load on the server, even 
though you are passing the parsing to the client... the server still has two 
or three requests verses one (php - one client request, one file returned, 
AJAX - original request for index.html, possible request for external 
javascript file [optional as it could be in the header], and the request for 
the XML file).
The best way to test would be implement both solutions (just a dummy set of 
data and layout), and script requests (this could be hard with AJAX - I do 
not know a way to script load testing for the JavaScript) - Actually using 
the firefox plugin that does auto-refresh would probably do it - just make 
sure you turn off your browser cache.  After doing thing, check the server 
load averages (using the 'uptime' command under linux).


>
> I have thought about just linking to an XML file while loading the news
> articles from the database and keeping the XML up to date as soon as a news
> is being added, but once again the reason for reducing the load on the
> server made me choose for AJAX. And I also thought about RSS, thanks for
> the suggestion though :).
Don't forget you can generate your XML and RSS dynamically using php, just 
like html.

>
> One more thing:
> Some may think this is way to much thinking for a small project as a
> fansite, but the reason for creating this website and thinking so thorough
> about this is because I'm increasing my experience with load balancing and
> use of other technologies and also increasing my knowledge about certain
> techniques. For a regular fansite this all this doesn't really matter but
> in my situation it is important ;).
>
> Thanks a million.
> ---
> Isaak

Playing with new technologies is good to get experience - my first AJAX 
project was a pretty complex front end for music player daemon (mpd). To turn 
my home server into a music player - the current track is constantly updated, 
complete with slider, time ticker, etc... it puts a bit of load on the server 
with just the number of requests (one or two per second to update playtime), 
but this is probably more to do with the way mpd passes the data to php (my 
playlists are usually on random with about 10-20 thousand tracks - we listen 
in the background.  It is a personal project, with no real external access, 
but it works really well..
Anyway, I guess I am saying, have fun experimenting with the technologies, but 
remember not to just assume that a given solution is less load then another - 
you might be very surprised - I know I have been.

-- 
Andrew Lowe
    System Administrator & Programmer
        Information Technology
            Manildra Group

Email:   andrew.lowe at manildra.com.au
Phone:   02 4423 8270
Mobile:  04 1323 8270
Fax:     02 4421 7760 


More information about the kdewebdev-webdeveloper mailing list