Sunday, May 31, 2015

more notes from the Thursday night talk

Chander Dhall's Thursday night presentation feeds notes I have here and here, and what is more...

  • Scalability, performance, responsiveness, availability, and downtime impact are all things to consider per Chander. This long list may be cleaned up a little perhaps to Consistency, Availability, and Partition Tolerance in Brewer's CAP Theorem in which CAP is an acronym for these three items. In a traditional project cost, quantity, and time are often the three variables and while two of them may be set in stone it's not realistic to expect success with all three locked. One of the three varies dependent on the others. In Brewer's CAP Theorem it's the same with the C, the A, and the P. Consistency suggests that nothing gets dropped while partition tolerance means that parts of the system will stay up even when one piece fails as defined in a whitepaper by Seth Gilbert and Nancy Lynch (following upon Eric Brewer's ideas) and that only total system failure should keep the system from being up. (Look for single points of failure and try to eliminate them.)
  • In a sticky session approach to load balancing there are many snapshots of the database and a particular snapshot will be kept in association with a specific user session for data consistency across the session, but the initial session distribution is randomized across the snapshots. This varies from round-robin DNS in which further upstream there are many different app servers and the DNS routing in is comparably varied. Part of Roy Fielding's REST spec is a requirement that no matter what server a hypertext transfer protocol request goes to, the next HTTP request should be able to go to ANY server. This does not cast a favorable light on round-robin DNS, but both of these ideas (sticky sessions too) are bad ideas per the consensus that emerged in Thursday night's talk.
  • fandango.com was praised for its search. It breaks searchable things into four categories that users care about and there isn't any random noise beyond the categorizations.
  • One scales out horizontally and up (adding more RAM and a bigger hard drive for instance) vertically. PolyglotPersistence (as exhibited at the second link I give in this blog posting at the very top) is an example of horizontal scaling. Polyglot as a term implies knowing many languages and I guess Chander's polyglot approach involves many data implementation means. I guess the syntax for interacting with the three merits three different languages.

Saturday, May 30, 2015

ten billion hits a day?

I saw Chander Dhall give a talk called "Best practices for scaling web apps (Platform Agnostic)" at the "Rockstar Developers/Designers Meetup" on Thursday night. The talk started out with theoretic "whiteboardings" in a slide presentation about how an architecture could start for a web application and how attempts are typically made to improve the architecture when it is not enough. Logical abstractions were collected together in dotted-lined circles and rectangles while straight lines denoted physical abstractions such as the app itself and the database starting out running at two different servers in the simplest example before any augmentations/enhancements. That is how we all start isn't it? Going through a list of debunked but once industry-embraced solutions for scaling, Chander eventually began to explain sticky sessions and at this point a member of the audience challenged that he didn't think there was anything bad about sticky sessions and that they were solving his company's scaling woes just fine with millions of hits a day being handled. Chander suggested the need to accommodate millions of hits a day was really a smaller problem than he aimed to tackle in his presentation and that he had his sights set on the biggest of challenges, handling ten billion hits a day in an ecommerce environment. In such a circumstance, yes, sticky sessions are just not enough. The real crème de la crème challenge (the one that really says: "If you can do this you can do anything.") lies in online sales at venues like amazon.com, and herein Chander suggests that one should set one's sights on handling ten billion hits a day, a number, yes, higher than the seven billion that is the population of Earth. The social media space may get the same volumes of traffic, but these guys handle the challenge by caving into it a bit and they can get away with that where online realtors cannot. If we attempt to post to Facebook and something screws up and we have to just try again, well, it's considered acceptable. We are all just numb to that now aren't we? It is not alright to lose sales here and there online. Beyond requests just failing, sales may be lost in lag. Chander sighted many metrics to point to how sales volume decays the slower a site may run, the longer it takes to load the home page, etc. One percent of sales fell off from Amazon when their process ended up taking a tenth of a second longer. There is big money at stake in performance. So let's jump right to the end and see Chander's solution. It involves using three different data solutions at three different pages of a web site at the first three different steps working inward in process. Why not use MSSQL everywhere? Well, joins are expensive. There are faster ways to go than using relational data. And so, three steps:

  1. The entry point should be assumed to be the home page of the site. While some may bookmark locales within ecommerce platforms it should be understood that most webfaring folk will just enter at the home page (the easiest URL to type and remember) and use the search box at the top of the navigation. Chander mentioned that he has never seen a home page hydrated by just one object, and indeed, beyond search, there is likely to be featured products on display at the home page of whatever.com and perhaps the menu system is also database driven. The important thing to keep in mind here is the search trumps all other objects in significance and you will want to get the search loaded and accessible first before you start pulling in the other stuff. Chander didn't explain how to do this, but I guess I'd pull in all secondary concerns by way of AJAX calls with JavaScript tags tucked away just before the closing body tag in HTML. This piece should be facilitated by Elasticsearch or Solr/Lucene. There will be an RDBMS (relational database management system) keeping records for the web site, yes, and to keep it jiving with this piece data we will have to be publishing data over, perhaps in a nightly process. At framesdirect.com this was being done, nightly, to facility Solr searching when I worked there.
  2. Every page one step in from the home page, including, for example, the "About Us" and "Contact Us" pages, but more importantly, the landing pages one finds from searching with products in exposition with pictures and descriptions are driven by NoSQL solutions such as MongoDB and RavenDB, but Chander did not have nice things to say about MongoDB and RavenDB and instead encouraged the use of Cassandra. He didn't spend too much time on why Cassandra, but he did suggest that Mongo drops records. Going back to my framesdirect.com experience, at this point we would be seeing data hydrated from MSSQL (not this middle step) and I wondered aloud how inventory data (i.e. is the product you are looking at actually available for purchase?) could make it up to these pages if the NoSQL data was also, I assume, pushed into place by a periodic process from the RDBMS. Chander suggested that inventory concerns should be addressed at the moment of checkout and not at the moment things are added to a shopping cart. He suggested that his wife will often spool things up in her shopping cart at amazon.com in a wishlist manner and wait days before checking out, so in this scenario the inventory would have to be rechecked at purchase time anyways and the possibility that something was not in stock would have to be addressed then too. If you think about it, the discrepancy between we-have-it-now and we-don't-have-anymore can happen even in the one second fast-as-possible trip between adding to cart and the checkout processing too, especially so at a web site with ten billion hits a day or perhaps in a scenario when tickets are being sold to a rock concert everyone is clamoring to see. You have to have the we-don't-have-anymore logic downstream from here.
  3. Next when we add stuff to a shopping cart we are in the RDBMS data's space. All of the pages to come downstream from here are driven by relational data. The real chokepoints have been addressed before these destinations.

Chander's final architecture looks like what is shown above. There were a lot more new (for me) things I learned about in this talk. Expect further blog postings on this subject matter.

a settings module in DotNetNuke

After one makes a module for the guts of a page as described here, one may give the web user control a separate web user control to drive its settings. While logged in as "host" one may see the settings for any one page by picking "Settings" from that menu which expands from the arrow at the upper left of any page. To make a "Settings" just make a new .ascx and then add a new moduleControl at the appropriate package at the .dnn file. This time the controlKey should contain "Settings" and the controlType should be "Edit" however. In the .ascx you may place controls and these controls may be interpreted at the other module. In the app I am looking at now we have some inheritance magic going on beyond the norm of DotNetNuke so a code snippet wouldn't really make sense assuming the default DotNetNuke wire-up. (sorry)

Make a new page in DotNetNuke!

  1. Strictly speaking, the .ascx which populates a page (comprises its guts) is not a part of the page itself. This piece is a module. Let's assume our new page is to have a new module though. Making both a new page and a new module is a bit more painful than just making a page standalone as there seems to be an assumption that in most circumstances administrators will just use the baked-in canned modules, but, doing things the hard way, the first step is to just make a new web user control in Visual Studio. Look at what the others inherit from at their code behinds and mimic this.
  2. The packages in a .dnn file are an important wireup for a page/module pairing. Copy and paste an existing entry into the file and then doctor it up to reference your .ascx at controlSrc. (There should be one module control in moduleControls and it should not define a controlKey, i.e. have an XML tag which just closes, and should have "View" as the controlType.)
  3. Make sure your templates are up to date from source control. In the root of your application folder there will be a "Portals" folder which will have a folder inside of it of your naming (er, your company's naming) which has your templates.
  4. Log in as host at the application.
  5. Make sure the templates are up to date within the application itself. Click the "admin" link at the ribbon at the top of the app and then the "Site Settings" icon on the page full of icons which appears. Finally, click the "Update" link at the very base of the "Site Settings" page which appears.
  6. Go back to the page full of icons and click on "Pages" instead of "Site Settings" this time. Make a page here.
  7. Edit Internal.sitemap back in Visual Studio to get the page to appear in the menu system.
  8. Visit your new page. From the arrow at the upper left (assuming you're logged in as "host") expand the menu and pick "Delete" to delete the default module. You will next add your module here.
  9. Click the "host" link at the ribbon at the top of the application and then click the "Portals" icon. You need to export the portal templates from here. As I type this I cannot really remember exactly how to do so. It looks like you may do so in an onesies and twosies way with the "Export Portal Template" option from the menu that expands from the arrow at the upper left.
  10. Commit to source control anew.

Addendum 7/12/2015: I believe "Module Definitions" will let you update templates. I have following notes on "Module Definitions" with regards to adding a module:

  1. Edit the .dnn file to add a module.
  2. Change the version number at the top of the .dnn file.
  3. Log in as host.
  4. Click the "Host" link at the top navigation and then the "Module Definitions" icon.
  5. Pick "Create New Module" from the menu that comes from that downward pointing arrow at the upper left.
  6. "Create Module From:" should be set to "Mainfest" and some of the other dropdowns should be comparably set to allow you to select your .dnn file.

Addendum 7/14/2015: "Module Definitions" will NOT let you update the templates. After you add a module, add it to a page to flip the No to a Yes for the line item at the list at Module Definitions. Make sure your new page isn't already in the sitemap in the wrong place too when trying to add a page to the sitemap.

Addendum 7/16/2015: Remember to click the "Include Content" checkbox when exporting a template.

Friday, May 29, 2015

My superior has a power supply for his Mac which doesn't plug in but instead sort of attaches to the side magnetically.

This keeps the end from being damaged when it is jerked away.

godaddy is no longer doing certificates for that which is not a public facing web site

modern, tricky security...

four things to say regarding AngularJS

  1. http://www.w3schools.com/angular/default.asp seems like a pretty good getting started guide.
  2. https://github.com/johnpapa/angular-styleguide is a guide for good code of sorts which Darryl Parker suggested in a meetup.com comment while also offering:
  3. "While in Rome, do as the Romans do. While working with Angular, I suggest following the Angular patterns. Angular has it's own dependency injection that works really well. " ...in response to a question I posed about whether it was wise to use an AMD pattern with Angular. I guess it is not wise.
  4. I saw Chander Dhall give a talk on "Best practices for scaling web apps (Platform Agnostic)" last night and he mentioned that he thinks Angular is dying. He said the two way binding has memory leaks and that the Angular team is to deal with it by just doing away with the two way binding in version 2.0. React is an emerging alternative. Chander seemed the most impressed with Aurelia however. A guy in the audience mentioned Meteor.js too. The link I provide here suggests it is of (tied to?) MongoDB and Node.js.