openxpc.source code is poetry!

5Apr/090

Lausitzblog - new theme

One of the openxpc projects comes out with a new wordpress theme. Check it out!

[Lausitzblog]

2Sep/081

[LB] with multiple database server

Load balancing is perhaps one of the trickiest things in building a scalable system. But the problem with load balancing in database traffic can easily solved with this code snippet:

function db_cluster_connect($cluster,$usr,$pw){ //<array>,<string>,<string>
shuffle($cluster); //shuffle the array (list) of available hosts
foreach($cluster as $host){
if($link = mysql_connect($host,$usr,$pw)) return $link;
}
return false;
}

Tagged as: , 1 Comment
6Aug/080

optimize webapplications [part 2]

Another idea to optimize webapplications is putting the CSS on the top of a webpage and the JS at the end of the page. The trick is, that the browser doesn't stop rendering the page for loading a javascript file. If the page is rendered, the browser requests the javascript files and stores them in its cache. The performance isn't really touched, but it's a better user expierence to see a fast page with the including stylesheet.

So, put the stylesheets at the TOP and the javascripts at the BOTTOM.

26Jul/080

optimize web applications [part 1]

A tricky way to optimize web applications is to generate .js and .css files with PHP. The particular rule here is to set the expires header in the future, so the browser isn't downloading these files again till the expires day of the header is arrived. If the browser cache is empty, the browser would cache the files again, otherwise not. A other benefit to use one PHP generated script is the agreement of the browser to load only 2 files parallel from one host. So you have only one .js file to download and one .css. In contrast to download for example 4 .js and 2 .css files in 3 sequences ( 6 files / 2 parallel downloads = 3 sequences) you only use one sequence. But watch at the code to understand: (pay attention to the headers)

Code

<?php
header("Content-type: text/javascript");
header("Cache-Control: cache");
header("Expires: Mon, 1 Jan 2020 00:00:00 GMT");
require("scripts/main.js");
require("scripts2/ajax.js");
?>

A addional trick to get a bit more performance is to generate gzipped files. To compress the file before response use: ob_start("ob_gzhandler"); at the end of the code sequence.

Filed under: PHP, optimization No Comments
23Jul/080

open extended power core goes online

Welcome everybody this is the open extended power core blog. OpenXPC is a new and fresh engineering team, that's working on a couple of software products. The field of intrests is very wide. The engineers work on some PHP, C#, Java and MYSQL projects... however the goal isn't a commercial one but a research.

We are a really young team from 17 up to 20 years. We hope that our projects and approaches reaches you.

Stay tuned... openxpc team.