<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>ingo() -&gt; tech. % Ingo Schramm - Scalability</title>
    <link>http://www.ingo-schramm.de/blog/</link>
    <description>Share experience in web development</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.3.1 - http://www.s9y.org/</generator>
    <pubDate>Wed, 27 May 2009 14:56:28 GMT</pubDate>

    <image>
        <url>http://www.ingo-schramm.de/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: ingo() -&gt; tech. % Ingo Schramm - Scalability - Share experience in web development</title>
        <link>http://www.ingo-schramm.de/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>What Erlang/OTP is good for and what it is not</title>
    <link>http://www.ingo-schramm.de/blog/archives/11-What-ErlangOTP-is-good-for-and-what-it-is-not.html</link>
            <category>Erlang</category>
            <category>Scalability</category>
            <category>Web 2.0</category>
            <category>Web Applications</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/11-What-ErlangOTP-is-good-for-and-what-it-is-not.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=11</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=11</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    Erlang/OTP is without any doubt a powerful tool. But as with any technology it&#039;s not good for any use case imaginable. It has a lot of strengths but some weaknesses too. Erlang glances in everything related to distribution and reliability. If you want to write software to be arbitrarily distributed over multiple instances, CPU cores, mashines or even data centers without having to change the programming paradigm for any particular case you probably have the perfect tool with Erlang. To benefit from Erlang you should have a problem best solved with a distributed solution. This may be reliable message passing or rock solid in memory storage but it is probably not web page generation and delivery. &lt;br /&gt;
&lt;br /&gt;
In the Internet world, Erlang is perfect for middle ware or backend systems like caches, message queues and exchanges, databases or storage abstractions. But it is probably not the right tool to write web applications. Sure, you may add a HTTP endpoint to your message middle ware or database but should you use Erlang in a way one usually uses JSP or PHP or Ruby? Probably not. Web applications have a very short life cycle. The business rules are in a constant flow and have to be changed over and over again. To define such rules in Erlang may turn out to be a very hard job. Despite of its expressiveness Erlang is not the language to be used as an embedded language as for Yaws dynamic content or in ehtml. It works - but it is comparably hard to maintain and not that fast in terms of execution time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s not that Erlang is a functional language but it&#039;s a functional language with a special syntax. There are all those commas, semicolons and dots and a pretty verbose notation for associative arrays, the records. The benefits of the syntax as for example how you deal with binary data is of little use when programming the business rules of a web application. It&#039;s simply not designed for such a use case. It&#039;s designed for writing reliable software dealing with network communication and related stuff. But it&#039;s not made to express complex rules in a domain specific language.&lt;br /&gt;
&lt;br /&gt;
On the other hand, the Erlang VM is highly optimized to spawn and execute a huge number of small processes but it&#039;s probably not optimized to execute a thread in the shortest possible time ever. Modern Java implementations may beat current Erlang easily. Sure, the maintainers of the Erlang VM do a lot of work improving both performance and SMP scalability but all those optimizations a not yet at the end. High performance is not the domain of the OTP.&lt;br /&gt;
&lt;br /&gt;
When you ever think about using Erlang, the first question to ask should be whether your problem deals with either redundancy, scalability or distribution. Second is whether you not have to deal with high performance as well, and you should not have to deal with the low lifetime of business rules. If you answer these questions with yes you get a highly optimized and convenient tool for the job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 27 May 2009 16:56:28 +0200</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/11-guid.html</guid>
    
</item>
<item>
    <title>PHP array_shift() does not scale</title>
    <link>http://www.ingo-schramm.de/blog/archives/9-PHP-array_shift-does-not-scale.html</link>
            <category>PHP</category>
            <category>Scalability</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/9-PHP-array_shift-does-not-scale.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=9</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    Arrays are at the core of PHP and act as the swiss army knife for data structures. They are known as an efficient and generic solution. But this is only half of the truth. The internal C representation as a hash table causes a non-intuitive performance behaviour of arrays. Associative arrays for example scale badly in key size and the different accessing functions like array_pop() and array_shift() behave very differently in respect to performance. I made a quick benchmark to visualize the difference. At least in loops it is more efficient to reverse the array and pop it instead of simply shifting it. This is because an array_shift() - strange enough - forces a reindexing operation for each shift.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- s9ymdb:1 --&gt;&lt;a href=&quot;http://www.ingo-schramm.de/blog/uploads/pop_vs_shift2.png&quot;&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;110&quot; height=&quot;82&quot; style=&quot;border: 0px; padding-left: 5px; padding-right: 5px;&quot; src=&quot;http://www.ingo-schramm.de/blog/uploads/pop_vs_shift2.serendipityThumb.png&quot; alt=&quot;&quot; target=&quot;_new&quot;/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This blog post is an appendix to another blog post I wrote about &lt;a href=&quot;http://developer.studivz.net/2009/03/18/php-spl-data-structures-benchmark/&quot; title=&quot;Benchmarking SPL Data Structures&quot;&gt;benchmarking SPL data structures&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Fri, 27 Mar 2009 11:39:24 +0100</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/9-guid.html</guid>
    
</item>
<item>
    <title>DDoP - new Attacks in the Cloud</title>
    <link>http://www.ingo-schramm.de/blog/archives/8-DDoP-new-Attacks-in-the-Cloud.html</link>
            <category>Scalability</category>
            <category>Web Applications</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/8-DDoP-new-Attacks-in-the-Cloud.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=8</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=8</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    Cloud computing becomes more and more popular. And it&#039;s cool, indeed. With Amazon webservices such as EC2, SimpleDB, S3 etc. or Google App Engine it is possible to build scalable web applications easily. Even self-scalable applications. Since AWS is completely based on web services not just for usage but for resource management also it should be possible to build an application detecting load peaks and starting up new nodes - all automatically.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, this cool technical feature also adds new attack vectors for black heads. New attacks may be based on the pricing model which is &quot;pay only for what you use&quot;. But, exacly that. Scince your application spreads automatically over an arbitrary number of new nodes and consumes an unlimited amount of resources attackers do not need to DDoS your application but just to run a DDoP. This is a &quot;Distributed Denial of Payment&quot; attack.&lt;br /&gt;
&lt;br /&gt;
Their bot nets just need to use the application the ordinary way. As load grows your resource usage grows and the same does your depts. &lt;br /&gt;
&lt;br /&gt;
There is a reason why startups use open source software, PostgreSQL for example, and not an Oracle with a per processor license. The same reason may let them choose a hosting solution where they pay what they &lt;em&gt;have&lt;/em&gt; and not what they &lt;em&gt;use&lt;/em&gt;. A startup company may soon reach the financial limits in a DDoP condition. So read my lips: don&#039;t miss to add some kind of throttle and a good bot and crawler detection when you enter the cloud.&lt;br /&gt;
&lt;br /&gt;
UPDATE&lt;br /&gt;
&lt;br /&gt;
You may also read this article about &quot;Cost Allocation&quot; as a new computing resource affecting algorithms:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://highscalability.com/cloud-programming-directly-feeds-cost-allocation-back-software-design&quot; title=cloud-programming-directly-feeds-cost-allocation-back-software-design&quot;&gt;http://highscalability.com/cloud-programming-directly-feeds-cost-allocation-back-software-design&lt;/a&gt; 
    </content:encoded>

    <pubDate>Tue, 03 Feb 2009 19:50:47 +0100</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/8-guid.html</guid>
    
</item>
<item>
    <title>Scalability from the beginning</title>
    <link>http://www.ingo-schramm.de/blog/archives/5-Scalability-from-the-beginning.html</link>
            <category>Scalability</category>
            <category>Web 2.0</category>
            <category>Web Applications</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/5-Scalability-from-the-beginning.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=5</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=5</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    Programmers love to talk about performance but only a few talk about scalability, despite of the fact that it is only scalability that counts. Scalability is about how your effort has to grow with your success. This is what you must have in mind if you start a business for the web.&lt;br /&gt;
&lt;br /&gt;
It is always a good idea to plan a new project for scalability from the first steps on. There are some easy task with just a little overhead in development but great benefit if your project reaches the level of success you&#039;ve intended.&lt;br /&gt;
&lt;br /&gt;
- divide and conquer in size and time&lt;br /&gt;
- use a good abstraction layer for data access to be free if you need to partition data&lt;br /&gt;
- avoid complicated joins and excessive normalization, they&#039;ll kill you if you have to distribute data over multiple data bases and mashines&lt;br /&gt;
- do you really need relational database schemas for everything or may a simple key-value-storage work as well&lt;br /&gt;
- cache data access from the beginning&lt;br /&gt;
- cache more, compute less&lt;br /&gt;
- use functional decomposition, partition your system in tiny and efficient units and plug them together by abstraction&lt;br /&gt;
- use asynchronous strategies to manage load peaks&lt;br /&gt;
- split static and dynamic content carefully, soon you may need a CDN to deliver static content&lt;br /&gt;
- apply a good deployment strategy with rollback&lt;br /&gt;
- measure and monitor performance and scalability systematically&lt;br /&gt;
- scale your revenue in parallel with your technology&lt;br /&gt;
&lt;br /&gt;
Don&#039;t miss the last point. It&#039;s the most important.&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 18 Nov 2008 20:37:59 +0100</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/5-guid.html</guid>
    
</item>
<item>
    <title>PHP Myth: static function call faster than instance function call</title>
    <link>http://www.ingo-schramm.de/blog/archives/4-PHP-Myth-static-function-call-faster-than-instance-function-call.html</link>
            <category>PHP</category>
            <category>Scalability</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/4-PHP-Myth-static-function-call-faster-than-instance-function-call.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=4</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=4</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    There exist a reasonable number of myths about PHP. One I will challenge today. If you ask an average PHP programmer whether a static function call or a function call on an instance performs better he or she will problably say - without thinking - static. This is wrong.&lt;br /&gt;
&lt;br /&gt;
Sure, if you want to call a method on an instance you first have to instantiate that instance. This takes some time by its own. The sum of CPU time for instantiation and a single method call is in fact greater than the CPU time needed to call a static function. So, if you ask for the time of single calls you will support the myth. But the question is wrong.&lt;br /&gt;
&lt;br /&gt;
In real life you will never do isolated calls. The question of interest is not how a single call performs but how the different kinds of method calls &lt;u&gt;scale&lt;/u&gt;. If you measure this you will get a different picture. The instance calls scale definitely better. If you even have just a handful of static method calls on a class the same calls on an instance - a singleton for example - will save you time. &lt;br /&gt;
&lt;br /&gt;
The image below shows a measurement with empty methods and light weight classes on PHP 5.2.5. The point where the two lines are crossing may vary with the complexity of your class.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;/img/static_vs_instance.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;/img/thumbs/static_vs_instance.png&quot; alt=&quot;PHP static call vs. instance call&quot; border=&quot;0&quot;/&gt;&lt;/a&gt; 
    </content:encoded>

    <pubDate>Tue, 18 Nov 2008 08:21:31 +0100</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/4-guid.html</guid>
    
</item>
<item>
    <title>How to improve PHP performance in 30 minutes</title>
    <link>http://www.ingo-schramm.de/blog/archives/3-How-to-improve-PHP-performance-in-30-minutes.html</link>
            <category>PHP</category>
            <category>Scalability</category>
    
    <comments>http://www.ingo-schramm.de/blog/archives/3-How-to-improve-PHP-performance-in-30-minutes.html#comments</comments>
    <wfw:comment>http://www.ingo-schramm.de/blog/wfwcomment.php?cid=3</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.ingo-schramm.de/blog/rss.php?version=2.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    

    <author>nospam@example.com (Ingo)</author>
    <content:encoded>
    You&#039;ve written a not so trivial PHP application and your web site is visited more and more frequently, 1 time per second, 10 times, 20 times per second, more. You transfered your database to a second mashine but still your webserver performance breaks down at 25 request per second. You install a byte code cache like the APC or XCache but your servers still do not deliver more than 30 or 40 requests. What now?&lt;br /&gt;
&lt;br /&gt;
You may spend some weeks to refactor your whole software. Or you invest 30 minutes to fix your file inclusions and you win some 100% performance - even more.&lt;br /&gt;
&lt;br /&gt;
The recipe is easy - watch your server process with strace, take care on file stats and try to reduce it to zero:&lt;br /&gt;
&lt;br /&gt;
- reduce your include_path to a single entry or don&#039;t use it at all&lt;br /&gt;
- include or require &lt;u&gt;absolute&lt;/u&gt; paths&lt;br /&gt;
- ensure that each try to include a file is a hit&lt;br /&gt;
- avoid file_exists(), is_file(), is_dir(), is_link() etc.&lt;br /&gt;
- avoid autoloading&lt;br /&gt;
&lt;br /&gt;
That&#039;s it.&lt;br /&gt;
&lt;br /&gt;
Each file system access forces the operating system to switch context and wastes a huge number of CPU cycles. If you have a long include path and the file to include is found at the end you have a lot of useless file stats. Even the byte code cache cannot protect you from this since it stores only files found, not files that do not exist. For each non existing file all the stats and lookups take place again and again. This is what your CPU works for, not your business logic.&lt;br /&gt;
&lt;br /&gt;
Stats are evil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Mon, 17 Nov 2008 21:35:19 +0100</pubDate>
    <guid isPermaLink="false">http://www.ingo-schramm.de/blog/archives/3-guid.html</guid>
    
</item>

</channel>
</rss>