Archive for January 31st, 2010

PHP

Not one of my favourite languages but very popular for rapid development of web applications, this interpreted language does a decent job on the front-end/ web facing/user-interface. However, it is interpreted which is extra work for the server. Caching can help but the answer is a compiler. Use PHP as it is to debug/develop rapidly your site but compile the code into machine readable stuff for faster execution. That is the obvious way to go and I did think to do such a project years ago, but it never amounted to anything. My concept was to rewrite important PHP scripts in Pascal so that they could compile properly.

The trolls here have pooh-poohed this idea, citing Facebook as an example of a high-powered/busy site running lots of PHP. Low, and behold, there is a story out that Facebook is working on a compiler for PHP.

Rumpus: So what will be the net effect of running the site on Hyper PHP?

Employee: We’re going to reduce our CPU usage on our servers by 80%, so practically, users will just see this as a faster site. Pages will load in one fifth of the time that they used to.

Facebook agrees. PHP is too slow as an interpreted language. QED.

Now, there are aspects of PHP that do not lend themselves to compiling like loose/flexible typing. The compiler has to make a choice at compile-time. This could be a fork of PHP or a new interface. We await the news.

Update: I tested the Roadsend PHP compiler against “Hello, World!”. My Pascal version executes in 0.001s according to time. The Roadsend version takes 0.1s. The difference? The statically linked version is 5.8MB! while my Pascal binary is 0.1MB. Maybe Hello, World! is not the best benchmark but it is an indication of problems with PHP compilers. Perhaps this is not an issue for FastCGI.

Update: Facebook has announced their project, HipHop,

HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP’s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

They have tweaked the language a bit and the runtime and compile it in C++ instead of interpreting the code. They get a 50% reduction in server load doing that so it pays in a big way. They will release the code as FLOSS later today. 50% may be no motivation at all for a light-weight site but for Facebook, it probably will save them millions annually in operating costs. For me, it could cut response time which is a great thing in a web app.

- Robert Pogson

Copenhagen Climate Council Promotes GNU/Linux on Thin Clients

The London Summit must agree that investment in low-emissions technology and infrastructure must be integral to government recovery packages in order to create jobs, foster innovation, and achieve energy security through the 21st century. Governments should individually implement and document their efforts in this regard.


see Their letter to G20 leaders.

If that is not a promotion of GNU/Linux on thin clients, I do not know what would be more clear. Energy produced by fossil fuels runs many PCs. If we replace the PCs with terminal servers and thin clients we can save a lot of power consumption:

  • typical thick client consumes about 100 watts apart from the monitor, keyboard and mouse
  • typical thin client can be 20 watts or less
  • the difference is about 80 watts saved per conversion to thin client, perhaps 75 watts because we need a terminal server which runs a bunch of thin clients
  • 75 watts saved times 1000 million PCs is 75 gigawatts

We can also save on production/waste costs because thin clients can last several times longer than most PCs.

On top of that we get ease of management and better performance with shared memory and file caching, no downside except video, which is why we can still have a few thick clients or televisions.

- Robert Pogson



Archives by Month

My Mission

My observations and opinions about IT are based on 40 years of use in science and technology and lately, in education. I like IT that is fast, cost-effective and reliable. I do not care whether my solution is the same as yours. I like to think for myself.

My first use of GNU/Linux in 2001 was so remarkably better than what I had been using, I feel it is important work to share GNU/Linux with the world. I have been blessed by working in schools where students and school systems have benefited by good, modular software easily installed in most systems.

I have shown GNU/Linux to thousands of students and hundreds of teachers over the years and will continue in some way doing that until I die in spite of the opposition.

Posts

January 2010
S M T W T F S
« Dec   Feb »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

    Writing

    2488 articles
    18599 comments

      Comments

      platforms
      linux 10349
      windows 8015
      macos 107
      wp 2
      sun 0

      browsers
      firefox 14332 
      safari 7212 
      chrome 7166 
      ie 2724 
      iceweasel 2035 
      opera 1232 
      konqueror 198 
      netnewswire 7 
      flock 0 
      lynx 0 
      bonecho 0 
      epiphany 0