Sacramento - JavaScript, Drupal - Drupal http://rocket.local/categories/drupal en Drupal 8 architecture decisions. Standing on the shoulders of giants. http://rocket.local/blog/drupal-8-architecture-decisions-standing-shoulders-giants <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><em>(Below are the two cents of someone who came to Drupal nearly nine years ago knowing only HTML and CSS, who worked hard to become a full fledged PHP developer, and has continued their programming education vis-a-vis rolling their own JavaScript framework and platform architecture for a large web application)</em></p> <p>Until recently I've been less than enthusiastic about Drupal 8, but I've changed my tune (and of course nothing is perfect; I am still a bit concerned/sad that Drupal 8 could possibly be leaving some smaller sites behind, but this is a ship that has likely sailed, so c'est la vie).</p> <p>What led to this change of heart? Simply, my understanding of just how much, and in what ways, Drupal 7 and previous versions of Drupal differ from widely established/modern techniques and/or best practices of higher level computer science/programming. Arguing whether this is true is comparable to arguing whether square wheels work better than round ones. All of the best programmers, across many different languages, and frameworks don't end up at the same basic conclusions for no reason. This is empirically evident for anyone who has looked around, studied, and experimented with solving problems that, as it turns out, have already been solved before. Drupal 8 will stand on the shoulders of these giants of programming.</p> <p>To wit, a Drupal 8 programmer will not need to feel behind the times to anyone developing in Java, Rails, Django, or you name it. In fact, a Drupal 8 programmer that embraces the changes and learns the fundamentals underneath the implementations will have a much easier time being able to grasp those other languages/frameworks because Drupal will share more fundamental paradigms with them than it differs by. The reverse is true as well, of course (e.g., programmers from other languages will have an easier time coming to Drupal).</p> <p>So, to keep this short I'll just close with this - embrace Drupal 8 and the future by starting to learn all the design patterns and OOP fundamentals you can (I recommend not just reading, but making something medium to large sized from scratch). The truth is this; if you think it's time to ditch Drupal and reach for anything other than WordPress -- objects, interfaces, design patterns, dependency injection, event models, etc will more than likely still be waiting for you there (and if it isn't I'd recommend passing, anyway). Drupal's architecture is just catching up with the rest of the more advanced computing world. Hop on board.</p> <p>P.S., the scale of refactoring that Drupal 8 is undergoing to shed it's imperative/procedural/tightly-coupled skin is truly a monumental task. Allocate your criticism and judgement appropriately, and give things some time to expand and evolve.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/oop" typeof="skos:Concept" property="rdfs:label skos:prefLabel">OOP</a></div><div class="field-item even"><a href="/categories/design-patterns" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Design patterns</a></div></div></div> Wed, 11 Sep 2013 06:03:28 +0000 Caleb Gilbert 140 at http://rocket.local http://rocket.local/blog/drupal-8-architecture-decisions-standing-shoulders-giants#comments Build your own JavaScript framework http://rocket.local/blog/build-your-own-javascript-framework <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>I've happily reached a significant milestone in the development of my project, finishing a foundational layer that by itself could be valid to open source at some point.</p> <p>Also:</p> <ul><li style="padding:0 0 10px 0;">In my last post I explained my reasons for passing on the current crop of JavaScript frameworks. This is a decision that I've been extremely pleased with, as I've managed to conceive/implement my own MVC/MVVM pattern for the project and the endeavor has pushed me much further into my JavaScript education.</li> <li style="padding:10px 0;">I have refactored the codebase from using 100% jQuery to about 80% raw JavaScript to 20% jQuery. It is nice to be able to know how to step outside of jQuery and/or deepen one's appreciation for what jQuery is doing under the hood. Also, if you've spent any time on jsperf.com at all you probably know that <a href="http://jsperf.com/comparing-jquery-and-native-js/11#bs-results">jQuery is much slower than raw JavaScript</a> for many things. When building an almost-entirely client-side app, speed starts to matter much more than when you have just a couple jQuery snippets on a page, and I want this app to be whip quick. It was a little ackward getting started with plain JS, but once underway I caught the hang of it fairly quickly, and the end result I'm definitely happy with.</li> <li style="padding:10px 0;">Currently, I am using <a href="https://developer.mozilla.org/en-US/docs/DOM/Storage">localStorage</a> for my data store, and it's been working great for development purposes - it's basically a mock mongoDB for me (I'm storing nested objects in localStorage using a small jQuery library called <a href="https://github.com/andris9/jStorage">jStorage</a>). I'm purposely putting off the server side of this application because I want to be able to use the Symfony 2.3 LTS release, which is scheduled for May as middleware between the client-side and mongoDB. The temptation to use node.js is strong, and arguably would be the most performant option, but the reasons for picking Symfony are probably obvious to any Drupal developer.</li> <li style="padding:10px 0;">Finally, don't forget - if you are using regex to parse the DOM, you're doing it <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454">brain-meltingly wrong</a>!</li> </ul><p>Cheers all, I'm off to <a href="http://sacdrupal.org/">DrupalCamp Sacramento</a> for the weekend.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/javascript" typeof="skos:Concept" property="rdfs:label skos:prefLabel">JavaScript</a></div><div class="field-item odd"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item even"><a href="/categories/symfony" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Symfony</a></div></div></div> Sat, 13 Apr 2013 02:46:46 +0000 Caleb Gilbert 129 at http://rocket.local http://rocket.local/blog/build-your-own-javascript-framework#comments Javascript Framework Redux http://rocket.local/blog/javascript-framework-redux <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><em>Part II in a series of articles about an online web application I am working on. <a href="/blog/side-project-part-1-getting-started">Read Part I</a></em></p> <p>I'm am currently in the process of making my own web service, which will have a single-page-app (SPA) type of structure/interface. This is exactly the type of project that the bevy of JavaScript frameworks like Backbone.js, Angularjs, Ember.js, Knockout.js, and Meteor are build for, thus I've taken it for granted that I would use one of these frameworks as the client-side infrastructure for my app. After much review and fiddling around it turns out that I will not be using one of them. At least not for now. Below are some of reasons why <em>(note these reasons may not apply to you, you may rightly decide that a Javascript framework is a great choice for your project(s) - these are one person's opinions only)</em>:</p> <h3>Using any of the frameworks requires more commitment from my code base than I want to give right now</h3> <p>One of my biggest surprises/disappointments after spending a lot of time with Backbone.js and Angularjs was realizing that my (imho) perfectly awesome JavaScript/jQuery foundation layer, which I just slaved over creating, would not only have to be modified - it would have to be thrown out the window. This is because none of these frameworks are a container for your JavaScript - they are a replacement for it. Sure you might use a little bit of JavaScript/jQuery within any one of the frameworks, but overall you'll be doing-Backbone, or doing-Angular, or doing-Ember, or whatever. It's even common advice for Angular experts to tell newbies to not use jQuery at all while they are getting started, so that they can learn the 'Angular way'. Thanks, but no thanks.</p> <p>I don't want to abandon my universally usable and performant JavaScript/jQuery that I can take and integrate easily into almost anything (well almost anything but these frameworks, apparently). Maybe in the future as one of the JS frameworks becomes more mature and dominant I will reconsider. Honestly, I think a platform would have be as ubiquitous as jQuery has grown to be, for me to volunteer myself for platform lock-in on the level these frameworks require now.</p></div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/javascript" typeof="skos:Concept" property="rdfs:label skos:prefLabel">JavaScript</a></div><div class="field-item odd"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item even"><a href="/categories/jquery" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Jquery</a></div></div></div> Mon, 01 Apr 2013 18:06:12 +0000 Caleb Gilbert 128 at http://rocket.local http://rocket.local/blog/javascript-framework-redux#comments A Side Project: Part 1, Getting Started http://rocket.local/blog/side-project-part-1-getting-started <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><em>"A Side Project" is a series of articles about an online web application I am working on. In Part 1 I share some of the thoughts and motivations which brought me to starting this project in the first place.</em></p> <p><img src="http://highervisibilitywebsites.com/files/newnold.jpg" alt="" style="float:right; margin: 0 0 0 .9em;" /><br /><strong>The seed for what is new, has some old roots</strong><br /> In 2005 I became involved with <a href="http://drupal.org">Drupal</a> after discovering it in the course of working on an ambitious <em>side project</em> of mine. It was a discovery that would change my life, professionally and otherwise, much for the better. Ironically, the very thing, which got me into Drupal in the first place (e.g., online side projects) had became one of the unfortunate casualties in more recent years as my professional Drupal activities increased. Sure, I had little projects - went to meetups, cons, made some patches here, contributed this there - but building my own online site/service from the ground up with the intention/hope of achieving something big, that went by the wayside.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/web-apps" typeof="skos:Concept" property="rdfs:label skos:prefLabel">web apps</a></div><div class="field-item even"><a href="/categories/saas" typeof="skos:Concept" property="rdfs:label skos:prefLabel">SaaS</a></div><div class="field-item odd"><a href="/categories/javascript" typeof="skos:Concept" property="rdfs:label skos:prefLabel">JavaScript</a></div></div></div> Tue, 19 Mar 2013 05:17:11 +0000 Caleb Gilbert 126 at http://rocket.local http://rocket.local/blog/side-project-part-1-getting-started#comments Example Varnish VCL for a Drupal / Pressflow site http://rocket.local/blog/example-varnish-vcl-drupal-pressflow-site <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><img src="http://highervisibilitywebsites.com/files/varnish-logo-red-64.gif" style="float:right; margin: 3px;" alt="" />A few months ago I set up Varnish on my Macbook Pro and have deployed it for a production site which serves anonymous and (a lot of) authenticated users. Initially, I spent a couple months just running it in my local environment, including backporting the <a href="http://drupal.org/project/Varnish">Varnish.module</a> to Drupal 5. In retrospect, I'm glad that I spent the time to learn how Varnish and it's configuration file works before deploying it, as it's paid off in a big way as our production site now has something which is equivalent to:</p> <ul><li>...an in-memory static file server for all users (e.g., the equivalent of hooking up something like nginx or <a href="/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining">lighttpd</a> as a front end to Apache (or whatever you're using).</li> <li>...an in-memory boost.module in terms of database-relief for anonymous users.</li> </ul><p>Contrary to popular belief the two items above are in no way an automatic benefit of simply installing Varnish. If the configuration file, and Drupal installation, is not massaged with care one definitely won't get the database relief from anonymous page caching, and the benefits from Varnish-as-a-static-file server will not nearly be optimized. Bottom line Varnish can be a temperamental piece of software. It only gives back what you put into it.</p> <p>To this end, the settings in the Varnish VCL file can make or break whether you get a substantial benefit from it. Below is an example VCL file, which was formed from a good amount of research and a lot of trial and error:</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/performance" typeof="skos:Concept" property="rdfs:label skos:prefLabel">performance</a></div><div class="field-item even"><a href="/categories/varnish" typeof="skos:Concept" property="rdfs:label skos:prefLabel">varnish</a></div><div class="field-item odd"><a href="/categories/pressflow" typeof="skos:Concept" property="rdfs:label skos:prefLabel">pressflow</a></div></div></div> Tue, 18 May 2010 20:14:39 +0000 Caleb Gilbert 103 at http://rocket.local http://rocket.local/blog/example-varnish-vcl-drupal-pressflow-site#comments Some highlights from Drupalcon San Francisco http://rocket.local/blog/some-highlights-drupalcon-san-francisco <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Drupalcon San Francisco was great. Here is some of what stood out to me, in no particular order:</p> <ul><li>Tim O'Reilly's keynote was great (see link for it in comments). It put perspective on where Drupal fits into the larger world and reminded me that I actually came to Drupal for a reason, not just for technology or Drupal itself. While listening to the keynote, I couldn't help but think that Dries' personal push for RDF in core (which I've seen some head-scratching about from some) might owe part of its genesis to his own talks with O'Reilly.</li> <li>The presentation <a href="http://sf2010.drupal.org/conference/sessions/you-shall-not-pass-managing-expectations-and-boundaries-clients">YOU SHALL NOT PASS: Managing Expectations and Boundaries of Clients</a> is one of the hidden gems of Drupalcon. If you're not project managing your clients/work the way they describe, you're doing it wrong (or at least for less money, more aggravation, and less satisfaction!).</li> <li>Larry Garfield's session <a href="http://sf2010.drupal.org/conference/sessions/objectifying-php">Objectifying PHP</a> was a wonderful session for anyone who is ready to move to the next level with object oriented methods (pun intended) and practices.</li> <li>The money, as well as the number of people, and type of people involved with Drupal these days has definitely changed the feel of the conference as compared to earlier ones I've attended. This is true even comparing it to DC which was only last year, let alone the first one I went to 4 years ago (OSCMS). There is no good or bad implied here, just worth noting since it has implications (and things will likely continue in this direction for a while).</li> <li>For the past year or so it's been cliche to say, 'No one person one can know everything about Drupal anymore'. For me the new saying is, 'No one person would even *want* to know everything about Drupal anymore'. There are vast, vast knowledge areas within Drupal that have their own following, experts, and activity levels. Don't get me wrong, it's *all* extremely interesting, but gazooks...</li> <li>For now videos/screencasts for presentations (they don't all seem to have them) can be found by going to <a href="http://sf2010.drupal.org/conference/sessions">this page</a> and clicking through to the individual presentation page you're interested in. UPDATE: <a href="http://www.archive.org/search.php?query=DrupalCon&amp;sort=-publicdate">Videos posted here too</a>.</li> <li>Hottest Drupal-related career: Project/QA manager. The need for developers and themers, is plenty hot of course, but I'd be willing to bet that at least some of the larger Drupal-based companies/shops would choose a competent project/QA manager over a competent developer if forced to choose only one.</li> <li>The way <a href="http://sf2010.drupal.org/conference/sessions/page-render-drill-down-drupal-7">Drupal 7's $page array, hook_page_alter, and drupal_render works</a>, simultaneously makes me want to use Drupal 7 RIGHT DARN NOW, as well as makes me wonder just how horrifically these features will be abused. (who needs a custom theme anymore - Garland with a bunch of hook_page_alters should work just fine, right) ;)</li> <li>If you want the sneak peak for the next North American Drupalcon, <a href="http://chicago2011.drupal.org/">look no further</a>.</li> </ul><p>If you have a highlight you'd like to share please leave a comment.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/drupalcon" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupalcon</a></div></div></div> Thu, 22 Apr 2010 22:21:36 +0000 Caleb Gilbert 102 at http://rocket.local http://rocket.local/blog/some-highlights-drupalcon-san-francisco#comments Drupal security: video example of user account hijacking with XSS http://rocket.local/blog/drupal-security-video-example-user-account-hijacking-xss <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded">In this short screencast a variety of security holes are shown, as well as some malicious things which are made possible due to these lapses. We'll take a walk-through of two security issues showcased in the <a href="http://crackingdrupal.com/content/drupal-vulnerable-module">vulnerable.module</a>, as well as two other exploits which I put together: <ul><li>User account hijacking via cookie/session XSS thievery</li><li>User account hijacking via password-changing-inline-XSS</ul> <div style="text-align:center;"> <div style="width:300px; margin-left:auto; margin-right:auto;"> <a href="javascript:playerPopUp('/sites/all/themes/higher_responsive/assets/drupal_security.html','900','601')"><img src="/sites/all/themes/higher_responsive/assets/drupal-security.png" alt="" /></a> </div> </div> <br />It's worth noting that in the screencast we demonstrate security exploits in the context of a Drupal installation which uses custom code (e.g., the examples in the video do not represent actual vulnerabilities in Drupal core). Likewise, these exploits and security holes potentially apply to any web site, Drupal or not, which accepts user input.<br /><br /> <strong>Links</strong><br /> <a href="http://crackingdrupal.com/">Cracking Drupal</a> (also, <a href="/improving-your-drupal-sites-security-cracking-drupal-review">my review</a>)<br /> <a href="http://drupal.org/writing-secure-code">Drupal.org: Writing secure code</a><br /> <a href="http://www.xssed.com/xssinfo">xssed.com</a></div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/security" typeof="skos:Concept" property="rdfs:label skos:prefLabel">security</a></div><div class="field-item even"><a href="/categories/javascript" typeof="skos:Concept" property="rdfs:label skos:prefLabel">JavaScript</a></div><div class="field-item odd"><a href="/categories/xss" typeof="skos:Concept" property="rdfs:label skos:prefLabel">xss</a></div></div></div> Tue, 02 Mar 2010 16:38:39 +0000 Caleb Gilbert 98 at http://rocket.local http://rocket.local/blog/drupal-security-video-example-user-account-hijacking-xss#comments Simple cross-browser Xdebug helper. Session starter and stopper, no add-ons needed. http://rocket.local/blog/simple-cross-browser-xdebug-helper-session-starter-and-stopper-no-add-ons-needed <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><img src="/files/xdebug-logo2.png" style="display:inline;margin:5px 15px 3px 0pt;float:left;" alt="" />During a recent browser upgrade I found myself stuck in a bit of a corner. The Firefox add-on I had been using, Xdebug Helper, was discontinued, and the supposed replacement add-on for it didn't work correctly.</p> <p>Since the functionality of this now-defunct add-on made my life a lot easier (e.g., don't have to manually append/strip '?XDEBUG_SESSION_START=default' in my browser all day long to start/stop debugging sessions) I took it upon myself to keep this functionality and perhaps get rid of yet-one-more-add-on (which pays off when upgrade time comes).</p> <p>In all their simplicity, here are two bookmarklets you can use to start and stop a Xdebug session in your browser of choice. Note that if you are using a custom proxy key value then you'll need to change the '=default' part in the bookmarklet to '<code>=YourProxyKey</code>'.</p> <p><strong>The 'start session' bookmark</strong><br /><a href="javascript:(function(){location.href=location.href+'?XDEBUG_SESSION_START=default';})();">Save this bookmark</a> and then all you need to do to start a debugging session (assuming that you have Xdebug setup correctly and a breakpoint set in your code, of course) is to select the bookmark. I chose to put my bookmarks in the Toolbar at the top of window to make it even easier to get to. Also, just for the sake of posterity here is the code for the bookmark.<br /><code>javascript:(function(){location.href=location.href+'?XDEBUG_SESSION_START=default';})();</code></p> <p><strong>The 'stop session' bookmark</strong><br /><a href="javascript:(function(){var currentUrl=location.href;var gotoUrl=currentUrl.replace('?XDEBUG_SESSION_START=default','');document.cookie='XDEBUG_SESSION=default;expires=Fri, 3 Aug 2001 20:47:11 UTC;host=none;path=/';location.href=gotoUrl;})();">Save this bookmark</a> and put it next to your 'start session' bookmark. When you're done with your session, simply click this bookmark and viola. Again, here is the code:<br /><code>javascript:(function(){var currentUrl=location.href;var gotoUrl=currentUrl.replace("?XDEBUG_SESSION_START=default","");document.cookie='XDEBUG_SESSION=default;expires=Fri, 3 Aug 2001 20:47:11 UTC;host=none;path=/';location.href=gotoUrl;})();</code></p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/php" typeof="skos:Concept" property="rdfs:label skos:prefLabel">php</a></div><div class="field-item even"><a href="/categories/xdebug" typeof="skos:Concept" property="rdfs:label skos:prefLabel">xdebug</a></div><div class="field-item odd"><a href="/categories/javascript" typeof="skos:Concept" property="rdfs:label skos:prefLabel">JavaScript</a></div></div></div> Mon, 01 Feb 2010 17:54:16 +0000 Caleb Gilbert 97 at http://rocket.local http://rocket.local/blog/simple-cross-browser-xdebug-helper-session-starter-and-stopper-no-add-ons-needed#comments Scaling Drupal: HTTP pipelining and benchmarking revisited http://rocket.local/blog/scaling-drupal-http-pipelining-and-benchmarking-revisited <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><strong>UPDATE: I've updated some of the numbers below to reflect corrections for a testing error. Let's just say to be sure not to benchmark with any external links in your test pages (because if you do use external links you'll obviously be benchmarking the external server too, which is not what we want in this case). To summarize the effect of these corrections - having lighttpd in front of Apache and pipelining actually provide a substantially larger boost in performance than I had indicated before. Other than that the results are the same.</strong></p> <p>So things with my <a href="http://highervisibilitywebsites.com/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining">first attempt at benchmarking HTTP pipelining</a> did not go exactly as planned. It turns out that if two different domains/subdomains you are using for content on your site are pointing to the same IP, <a href="http://highervisibilitywebsites.com/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining">based on previous testing</a>, it looks like browsers (at least FireFox) will not pipeline requests (e.g., create more concurrent requests to your site) because it considers the requests as being from the same origin. In order for a browser to pipelining requests at all, they seem to require two domains/subdomains which are using <em>two separate/unique IPs</em>. If you read the <a href="http://en.wikipedia.org/wiki/Hostname">Wikipedia entry for hostnames</a> this all makes sense, as it indicates domains are associated with IP's, and <a href="http://www.browserscope.org/">browserscope's</a> testing of browsers checks for "Connections per Hostname", not "Connections per Domain".</p> <p>After figuring out how to get requests to pipeline correctly, I re-benchmarked all the configurations from the <a href="http://highervisibilitywebsites.com/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining">first article </a>. Everything from that article regarding lighttpd is still holds true, so without covering those aspects again, here's the updated benchmarks and notes for browser request pipelining:</p> <ul><li>Once the conditions for request pipelining was setup correctly there were discernable performance implications. Some of them I definitely wasn't expecting. On the one end of the spectrum, with browser pipelining working (via string replacement of domains within the rendered HTML) and lighttpd serving the static files there was an 11% increase in throughput vs not using the pipelining methods. So static file serving ='s good, and static file serving + HTTP pipelining ='s a little better. <p>This is not where the story ends with pipelining however, as there was a net performance <em>decrease</em> by enabling pipelining with all configurations which did not use a separate static file server! (in my case lighttpd on the same machine)</p></li></ul></div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/performance" typeof="skos:Concept" property="rdfs:label skos:prefLabel">performance</a></div><div class="field-item even"><a href="/categories/optimization" typeof="skos:Concept" property="rdfs:label skos:prefLabel">optimization</a></div><div class="field-item odd"><a href="/categories/lighttpd" typeof="skos:Concept" property="rdfs:label skos:prefLabel">lighttpd</a></div></div></div> Wed, 27 Jan 2010 23:37:28 +0000 Caleb Gilbert 96 at http://rocket.local http://rocket.local/blog/scaling-drupal-http-pipelining-and-benchmarking-revisited#comments Scaling Drupal: Benchmarking static file serving with lighttpd and browser pipelining http://rocket.local/blog/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><img src="/files/light_logo_170px.png" style="display:inline;margin:5px 15px 3px 0pt;float:left;" alt="" />I finally had a chance to investigate an optimization which I've been wondering about for a while now - serving static files of a site from somewhere else. As a side, but related, experiment I also tested the claim that serving files from a static file server/separate domain/subdomain will speed things up because it results in browsers opening more concurrent requests than they would from a single domain.</p> <p>For my tests I used lighttpd (pron. <em>lighty</em>) as a static file server for Apache. The idea is that lighttpd, which is acclaimed as being fast and light on memory, will serve the non-dynamic pages of the site (images, CSS, Javascript, etc), which should thereby help relieve Apache of some of its workload. This arrangement involves changing the paths, either on the backend or frontend, to these static resources so that they no longer get served by Apache.</p> <p><strong>The pieces</strong><br /> All tests took place on my Macbook Pro and involved two pages on a large Drupal 5 site running Pressflow. For the static file server itself, I installed lighttpd using Macports. Two separate pages of the site were tested, the smaller page's number of static files was in the category of 'average' for most sites. The larger page of the two, was very large - 39 CSS files, 23 Javascript files, and 46 image files.</p> <p><strong>Methods tested and benchmarked</strong><br /> I implemented and benchmarked the following methods of path modification in order to enable static file serving:</p></div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Categories:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/categories/drupal" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Drupal</a></div><div class="field-item odd"><a href="/categories/apache" typeof="skos:Concept" property="rdfs:label skos:prefLabel">Apache</a></div><div class="field-item even"><a href="/categories/performance" typeof="skos:Concept" property="rdfs:label skos:prefLabel">performance</a></div><div class="field-item odd"><a href="/categories/lighttpd" typeof="skos:Concept" property="rdfs:label skos:prefLabel">lighttpd</a></div></div></div> Mon, 25 Jan 2010 17:50:09 +0000 Caleb Gilbert 95 at http://rocket.local http://rocket.local/blog/scaling-drupal-benchmarking-static-file-serving-lighttpd-and-browser-pipelining#comments