SlideShare una empresa de Scribd logo
1 de 45
SSJS, NoSQL, GAE, and
      AppEngineJS
The new wave of web server technologies




                   1
JavaScript: beyond browser

• The program:
  • Web development is changing. Again.
  • Rise of NoSQL.
  • Server-side JavaScript (SSJS). CommonJS.
  • Short primer: Google App Engine.
  • Short primer: AppengineJS.
                      2
Web development: timeline

• Shift to compiled languages and managed
 infrastructure:

  • 1995: Java
  • 1997: Java Servlet
  • 2001: C#
  • 2002: .NET

                         3
Web development: timeline

• Shift to dynamic languages and “scripts”:
  • 2004-2005: Ruby on Rails
  • 2003-2005: Django (Python)
  • 2005: TurboGears, Pylons (Python)
  • 2005: Catalyst (Perl)
  • Other languages followed too.
                       4
Web development: timeline

• Why the shift in mid-2000s?
  • RAD
  • Better understanding of performance
    bottlenecks.

    • CPU is not a bottleneck usually.
  • Smarter building blocks.

                      5
Next shift: now
• What changed in last 5 years?
  • Ajax gone mainstream: JavaScript is popular.
  • Social networks require a massive scale:
    high-performance, clouds.

  • Existing SQL limitations started to hit
    regular web developers: NoSQL.

  • Rising interest in asynchronous evented
    servers.
                       6
Factor: Ajax

• A lot of people familiar with JavaScript now.
•   JS in browsers are asynchronous by necessity:
    many people understand async techniques now.

• Distributed computing: CPU cycles can be
    moved from a server to a client.

• Boosters: ECMA 262 v5, CommonJS, HTML5,
    new browser arms race.

                         7
Factor: Ajax

• Better JS engines:
    • Google’s V8 (used in Google Chrome).
    • Opera, Mozilla, Apple improved their JS
      engines greatly.

•   JS is the second most popular language (after
    Ruby) on Github:

    • github.com/languages
                         8
Factor: NoSQL
• Theoretical and practical SQL problems:
  • Optimized for indexed queries: can exhibit
    poor performance in other scenarios like
    frequent writes.

  • Hard to scale horizontally: requires powerful
    expensive servers.

  • Problems of one-size-fits-all solutions:
    different uses require different trade-offs.

                         9
Factor: NoSQL

• NoSQL does not mean an anti-SQL.
  • The original meaning: Not Only SQL.
  • Umbrella term for different data-related
   technologies.

  • Different classes of tasks may require
   different trade-offs to improve the
   performance.

                      10
Factor: NoSQL

• Grossly incomplete, alphabetized sample list:
  • BigTable (Google’s formerly secret sauce).
  • Cassandra, CouchDB
  • memcached, memcachedb, MongoDB
  • Persevere, Redis, Riak

                       11
Factor: NoSQL

• Sample of addressed problems:
  • Speed at expense of data integrity.
  • Transient memory-based databases.
  • Simple horizontal scalability, replication, and
    fault tolerance.

  • Automating frequent administration tasks.

                       12
Cross-pollination: JS &
           NoSQL
• Some NoSQL databases use JS as a scripting
 language.

  • CouchDB uses it to define views, validate
    and transform objects, in MapReduce.

  • Riak can use it for MapReduce queries.
  • Persevere supports SSJS.

                      13
Factor: asynchronicity
• Evented/async IO vs. multi-threaded IO:
  • All modern OSes use async IO under the
    hood.

    • Potentially it means less abstraction
      penalties for async servers.

  • Evented web servers (lighttpd, nginx) proved
    to be great in high-performant scenarios.

  • Some tasks are easier with events (Comet).
                       14
Factor: asynchronicity

• In general it is a controversial topic.
  • Multi-threaded servers can be performant.
     • Need good runtime and OS.
  • Many tasks are easier to write as a sequential
    code.

  • Synchronization-free structures and clever
    algorithms can avoid common problems.

                         15
Factor: asynchronicity
• But EDP (event-driven programming) rocks:
  • Everything is essentially single-threaded.
  • In most cases:
    • No need to synchronize.
    • No need to switch context.
    • No need to allocate thread-related
      resources.

                       16
Cross-pollination: JS & EDP

•   JS programmers know EDP.

    • This is exactly how we process browser
     events.

    • This is exactly how we do IO in most cases.
• Culturally JS looks like a good fit.


                        17
SSJS: timeline
• 1996: Netscape’s LiveWire
• 1996: Microsoft’s ASP
• 2005-2009: Helma/RingoJS, Narwhal,
 Persevere, Pintura.

• 2009: ServerJS/CommonJS
• 2009: node.js
• 2009: AppengineJS
                       18
SSJS: CommonJS

• Started by Kevin Dangoor in 2009.
  • Yes, the same guy who started TurboGears in
    2005.

• Led by Kris Kowal.
• Targets non-browser environments.
• www.commonjs.org

                       19
SSJS: CommonJS


• Provides interoperability standards and
 guidelines.

• Defines a common module format.
  • Targets synchronous loader => not exactly
    browser-friendly.



                        20
SSJS: CommonJS
• Modules are simple to write:
  • The code is sandboxed.
  • If you want to import something, assign it to
    a global object named export.

• Modules are simple to use:
  • Use require(module) to get its export
    object.

                       21
SSJS: CommonJS
• Example:

var sqr = require(’arithm’).sqr;

exports.len = function(a, b) {
   return Math.sqrt(sqr(a) + sqr(b));
};




                  22
SSJS: node.js
• The most popular SSJS environment at the
 moment.

• Built on Google’s V8.
• Founded on evented IO.
• Supports some CommonJS specs.
• Has a lot of active contributors.
• Low-level libraries are written in C.
                          23
GAE: short primer
• Google App Engine: the foundation of Google.
• Provides access to a host of services used at
 Google.

  • Datastore (BigTable), users, mail, XMPP
    (Jabber, Google Talk), URL fetch, BLOBs,
    simple image processing, task queues.

  • More services are coming, like Channels API
    (Comet!).

                        24
GAE: short primer

• Free and paid plans are available.
• Google App Engine for Business is available.
• Python and Java SDKs are supported:
  • You can use JVM-based languages too!
     •   JRuby

     •   JavaScript on Rhino.

                        25
GAE: short primer

• BigTable is NoSQL:
  • Pros:
     • Good performance.
  • Cons:
     • A lot of restrictions.
• In general GAE has a lot of restrictions.
                        26
GAE: short primer
• Examples of restrictions:
  • Request processing should be less than 30
    seconds.

  • Response size should be less than 10M.
  • App size should be less than 150M.
• These restrictions are universal:
  • Paid accounts affected too.
                        27
GAE: short primer

• Free account restrictions (daily quotas):
  • 1G bandwidth (in and out separately).
  • 6.5h of CPU time.
  • 1.3M HTTP requests.
  • 10M datastore calls.
  • 1G data stored.
                        28
GAE: short primer

• Examples of datastore (BigTable) restrictions:
  • No joins.
  • Inequality filter (<, >, <=, >=, !=) can be used
    only on one property at the same time.

  • Complicated sorting rules.
  • Transactions can be executed only within the
    same entity group.

                         29
GAE: short primer
• Wow! What is good about GAE?
  • Scalability is built in and automatic.
    • No need to deploy on different servers.
    • No need to back up.
    • Number of running instances are scaled
      automatically.

  • Google IO is fast.
                         30
GAE: short primer
• Wow! What is good about GAE?
  • Convenient administration tools.
    • Supports running several versions of your
      application side-to-side.

    • Easy to select the default version.
    • Easy to check stats.
    • Easy to administer users.
                       31
GAE: short primer

• Wow! What is good about GAE?
  • Super-simple Development SDK:
    • Provides the environment and two
     commands: run locally, and deploy.

    • Easy to run and debug locally using your
     favorite development tools.


                      32
GAE: short primer




  DEMO

        33
AppengineJS: primer

• Created by George Moschovits
• Build on top of RingoJS (www.ringojs.org).
  • Built on top of Rhino (JVM-based).
       • Can be run on GAE!
• The foundation is Java.

                       34
AppengineJS: primer

• Faithfully implements Python API to GAE.
  • Python is much closer to JS than Java.
• Google’s Python API docs can be used when
 programming with AppengineJS.

• No need to know Java at all.
  • It never hurts to know some Java. ;-)

                       35
AppengineJS: primer


• Internally uses Jack (like Ruby’s Rack) and
 Nitro (a set of middleware and utilities).

• Shipped with an optional normal-template
 package for simple templating.

• Unbelievably simple APIs.


                       36
AppengineJS: primer
    • Example of a Jack web application:
      • A function, which takes a request object and
        returns a response object.
function(env) {
  return {
     status: 200,
     headers: {”Content-Type”:”text/plain”},
     body: [”Hello, world!”]
  };
}
                           37
AppengineJS: primer

• On top of this simple specification Nitro
 provides middleware functions.

  • Middleware is used to pre-process a request
    and to post-process a response.

  • Usually middleware is nested like
    matryoshka.

  • The inner-most function is a request handler.

                      38
AppengineJS: primer
• Following middleware is provided by Nitro out
 of box:

  • dispatch() maps a requested path to a
    handler function.

  • setup() implements most common
    operations like content size calculations and
    so on.

  • memcache() allows to cache responses.
                        39
AppengineJS: primer

• Following middleware is provided by Nitro out
 of box:

  • errors() handles exceptions.
  • render() takes the result data and applies it
    to a template.

• It is super easy to add your own middleware.

                       40
AppengineJS: primer




   DEMO

         41
SSJS vs. Browser for devs

• Controlled environment:
  • No need to support legacy JS (like IE).
    • You can freely use getters/setters.
    • Array enhancements are available.
  • Easier to debug.

                       42
SSJS vs. Browser for devs

• No need to worry about the download size of
    programs.

    • More sophisticated libraries can be used.
•   JSON translates natively on both sides.

•   JS techniques translate well to SSJS.



                         43
SSJS vs. Browser for devs
• Non-DOM libraries can be reused on both
 sides.

  • Big potential to reuse the same code client-
    side and server-side. Example:

    • Initial rendering of a page can be done on
      the server.

    • Subsequent updates/changes can be done
      on the client.

                       44
Summary
• End-to-end JS solutions have a big potential.
    This is a viable option for new web projects.

• New trends in web development can change
    the landscape. Keep your eye on it!

• There is life beyond virtual machines and
    hosted solution. Do you homework!

• Always evaluate NoSQL for your projects!
•   JavaScript is fun!
                         45

Más contenido relacionado

La actualidad más candente

DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemFITC
 
Real-world Experiences in Scala
Real-world Experiences in ScalaReal-world Experiences in Scala
Real-world Experiences in ScalaAmir Karimi
 
Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Jagadeesha DG
 
MySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixMySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixFromDual GmbH
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.jsratankadam
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceAlex Tumanoff
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Ryan Cuprak
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraKishore Chandra
 
Gwt overview & getting started
Gwt overview & getting startedGwt overview & getting started
Gwt overview & getting startedBinh Bui
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Ryan Cuprak
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprisesMike Slinn
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataJohn Nestor
 
MySQL HA Percona cluster @ MySQL meetup Mumbai
MySQL HA Percona cluster @ MySQL meetup MumbaiMySQL HA Percona cluster @ MySQL meetup Mumbai
MySQL HA Percona cluster @ MySQL meetup MumbaiRemote MySQL DBA
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web FrameworksJoe Kutner
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsBrettTasker
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageRan Levy
 
Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Michel Schildmeijer
 

La actualidad más candente (20)

DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
 
Real-world Experiences in Scala
Real-world Experiences in ScalaReal-world Experiences in Scala
Real-world Experiences in Scala
 
Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01
 
MySQL Monitoring with Zabbix
MySQL Monitoring with ZabbixMySQL Monitoring with Zabbix
MySQL Monitoring with Zabbix
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.js
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Venkata
VenkataVenkata
Venkata
 
Dibi Conference 2012
Dibi Conference 2012Dibi Conference 2012
Dibi Conference 2012
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore Chandra
 
Gwt overview & getting started
Gwt overview & getting startedGwt overview & getting started
Gwt overview & getting started
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big Data
 
MySQL HA Percona cluster @ MySQL meetup Mumbai
MySQL HA Percona cluster @ MySQL meetup MumbaiMySQL HA Percona cluster @ MySQL meetup Mumbai
MySQL HA Percona cluster @ MySQL meetup Mumbai
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritage
 
Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020
 

Destacado

DojoX GFX Session Eugene Lazutkin SVG Open 2007
DojoX GFX Session Eugene Lazutkin SVG Open 2007DojoX GFX Session Eugene Lazutkin SVG Open 2007
DojoX GFX Session Eugene Lazutkin SVG Open 2007Eugene Lazutkin
 
Exciting JavaScript - Part I
Exciting JavaScript - Part IExciting JavaScript - Part I
Exciting JavaScript - Part IEugene Lazutkin
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Eugene Lazutkin
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slidesEugene Lazutkin
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 

Destacado (6)

DojoX GFX Session Eugene Lazutkin SVG Open 2007
DojoX GFX Session Eugene Lazutkin SVG Open 2007DojoX GFX Session Eugene Lazutkin SVG Open 2007
DojoX GFX Session Eugene Lazutkin SVG Open 2007
 
Exciting JavaScript - Part I
Exciting JavaScript - Part IExciting JavaScript - Part I
Exciting JavaScript - Part I
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)
 
Dojo GFX workshop slides
Dojo GFX workshop slidesDojo GFX workshop slides
Dojo GFX workshop slides
 
RAD CRUD
RAD CRUDRAD CRUD
RAD CRUD
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 

Similar a SSJS, NoSQL, GAE and AppengineJS

What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?Balajihope
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Building FoundationDB
Building FoundationDBBuilding FoundationDB
Building FoundationDBFoundationDB
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stackAshok Raj
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java Hitesh-Java
 
Developing a mobile cross-platform library
Developing a mobile cross-platform libraryDeveloping a mobile cross-platform library
Developing a mobile cross-platform libraryKostis Dadamis
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJSTim Sommer
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to JavaPawanMM
 
The Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey VasilievThe Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey VasilievPivorak MeetUp
 
Node.js for .NET Developers
Node.js for .NET DevelopersNode.js for .NET Developers
Node.js for .NET DevelopersDavid Neal
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Ethan Ram
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2RatnaJava
 

Similar a SSJS, NoSQL, GAE and AppengineJS (20)

What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
Mean stack
Mean stackMean stack
Mean stack
 
Pulsar
PulsarPulsar
Pulsar
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Building FoundationDB
Building FoundationDBBuilding FoundationDB
Building FoundationDB
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java
 
Developing a mobile cross-platform library
Developing a mobile cross-platform libraryDeveloping a mobile cross-platform library
Developing a mobile cross-platform library
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to Java
 
The Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey VasilievThe Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey Vasiliev
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Node.js for .NET Developers
Node.js for .NET DevelopersNode.js for .NET Developers
Node.js for .NET Developers
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2
 
PaaS with Java
PaaS with JavaPaaS with Java
PaaS with Java
 

Más de Eugene Lazutkin

Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScriptEugene Lazutkin
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.jsEugene Lazutkin
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Eugene Lazutkin
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldEugene Lazutkin
 
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007Eugene Lazutkin
 

Más de Eugene Lazutkin (13)

Service workers
Service workersService workers
Service workers
 
Advanced I/O in browser
Advanced I/O in browserAdvanced I/O in browser
Advanced I/O in browser
 
Streams
StreamsStreams
Streams
 
Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScript
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.js
 
TXJS 2013 in 10 minutes
TXJS 2013 in 10 minutesTXJS 2013 in 10 minutes
TXJS 2013 in 10 minutes
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
 
CRUD with Dojo
CRUD with DojoCRUD with Dojo
CRUD with Dojo
 
Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real world
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
 
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
 

Último

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

SSJS, NoSQL, GAE and AppengineJS

  • 1. SSJS, NoSQL, GAE, and AppEngineJS The new wave of web server technologies 1
  • 2. JavaScript: beyond browser • The program: • Web development is changing. Again. • Rise of NoSQL. • Server-side JavaScript (SSJS). CommonJS. • Short primer: Google App Engine. • Short primer: AppengineJS. 2
  • 3. Web development: timeline • Shift to compiled languages and managed infrastructure: • 1995: Java • 1997: Java Servlet • 2001: C# • 2002: .NET 3
  • 4. Web development: timeline • Shift to dynamic languages and “scripts”: • 2004-2005: Ruby on Rails • 2003-2005: Django (Python) • 2005: TurboGears, Pylons (Python) • 2005: Catalyst (Perl) • Other languages followed too. 4
  • 5. Web development: timeline • Why the shift in mid-2000s? • RAD • Better understanding of performance bottlenecks. • CPU is not a bottleneck usually. • Smarter building blocks. 5
  • 6. Next shift: now • What changed in last 5 years? • Ajax gone mainstream: JavaScript is popular. • Social networks require a massive scale: high-performance, clouds. • Existing SQL limitations started to hit regular web developers: NoSQL. • Rising interest in asynchronous evented servers. 6
  • 7. Factor: Ajax • A lot of people familiar with JavaScript now. • JS in browsers are asynchronous by necessity: many people understand async techniques now. • Distributed computing: CPU cycles can be moved from a server to a client. • Boosters: ECMA 262 v5, CommonJS, HTML5, new browser arms race. 7
  • 8. Factor: Ajax • Better JS engines: • Google’s V8 (used in Google Chrome). • Opera, Mozilla, Apple improved their JS engines greatly. • JS is the second most popular language (after Ruby) on Github: • github.com/languages 8
  • 9. Factor: NoSQL • Theoretical and practical SQL problems: • Optimized for indexed queries: can exhibit poor performance in other scenarios like frequent writes. • Hard to scale horizontally: requires powerful expensive servers. • Problems of one-size-fits-all solutions: different uses require different trade-offs. 9
  • 10. Factor: NoSQL • NoSQL does not mean an anti-SQL. • The original meaning: Not Only SQL. • Umbrella term for different data-related technologies. • Different classes of tasks may require different trade-offs to improve the performance. 10
  • 11. Factor: NoSQL • Grossly incomplete, alphabetized sample list: • BigTable (Google’s formerly secret sauce). • Cassandra, CouchDB • memcached, memcachedb, MongoDB • Persevere, Redis, Riak 11
  • 12. Factor: NoSQL • Sample of addressed problems: • Speed at expense of data integrity. • Transient memory-based databases. • Simple horizontal scalability, replication, and fault tolerance. • Automating frequent administration tasks. 12
  • 13. Cross-pollination: JS & NoSQL • Some NoSQL databases use JS as a scripting language. • CouchDB uses it to define views, validate and transform objects, in MapReduce. • Riak can use it for MapReduce queries. • Persevere supports SSJS. 13
  • 14. Factor: asynchronicity • Evented/async IO vs. multi-threaded IO: • All modern OSes use async IO under the hood. • Potentially it means less abstraction penalties for async servers. • Evented web servers (lighttpd, nginx) proved to be great in high-performant scenarios. • Some tasks are easier with events (Comet). 14
  • 15. Factor: asynchronicity • In general it is a controversial topic. • Multi-threaded servers can be performant. • Need good runtime and OS. • Many tasks are easier to write as a sequential code. • Synchronization-free structures and clever algorithms can avoid common problems. 15
  • 16. Factor: asynchronicity • But EDP (event-driven programming) rocks: • Everything is essentially single-threaded. • In most cases: • No need to synchronize. • No need to switch context. • No need to allocate thread-related resources. 16
  • 17. Cross-pollination: JS & EDP • JS programmers know EDP. • This is exactly how we process browser events. • This is exactly how we do IO in most cases. • Culturally JS looks like a good fit. 17
  • 18. SSJS: timeline • 1996: Netscape’s LiveWire • 1996: Microsoft’s ASP • 2005-2009: Helma/RingoJS, Narwhal, Persevere, Pintura. • 2009: ServerJS/CommonJS • 2009: node.js • 2009: AppengineJS 18
  • 19. SSJS: CommonJS • Started by Kevin Dangoor in 2009. • Yes, the same guy who started TurboGears in 2005. • Led by Kris Kowal. • Targets non-browser environments. • www.commonjs.org 19
  • 20. SSJS: CommonJS • Provides interoperability standards and guidelines. • Defines a common module format. • Targets synchronous loader => not exactly browser-friendly. 20
  • 21. SSJS: CommonJS • Modules are simple to write: • The code is sandboxed. • If you want to import something, assign it to a global object named export. • Modules are simple to use: • Use require(module) to get its export object. 21
  • 22. SSJS: CommonJS • Example: var sqr = require(’arithm’).sqr; exports.len = function(a, b) { return Math.sqrt(sqr(a) + sqr(b)); }; 22
  • 23. SSJS: node.js • The most popular SSJS environment at the moment. • Built on Google’s V8. • Founded on evented IO. • Supports some CommonJS specs. • Has a lot of active contributors. • Low-level libraries are written in C. 23
  • 24. GAE: short primer • Google App Engine: the foundation of Google. • Provides access to a host of services used at Google. • Datastore (BigTable), users, mail, XMPP (Jabber, Google Talk), URL fetch, BLOBs, simple image processing, task queues. • More services are coming, like Channels API (Comet!). 24
  • 25. GAE: short primer • Free and paid plans are available. • Google App Engine for Business is available. • Python and Java SDKs are supported: • You can use JVM-based languages too! • JRuby • JavaScript on Rhino. 25
  • 26. GAE: short primer • BigTable is NoSQL: • Pros: • Good performance. • Cons: • A lot of restrictions. • In general GAE has a lot of restrictions. 26
  • 27. GAE: short primer • Examples of restrictions: • Request processing should be less than 30 seconds. • Response size should be less than 10M. • App size should be less than 150M. • These restrictions are universal: • Paid accounts affected too. 27
  • 28. GAE: short primer • Free account restrictions (daily quotas): • 1G bandwidth (in and out separately). • 6.5h of CPU time. • 1.3M HTTP requests. • 10M datastore calls. • 1G data stored. 28
  • 29. GAE: short primer • Examples of datastore (BigTable) restrictions: • No joins. • Inequality filter (<, >, <=, >=, !=) can be used only on one property at the same time. • Complicated sorting rules. • Transactions can be executed only within the same entity group. 29
  • 30. GAE: short primer • Wow! What is good about GAE? • Scalability is built in and automatic. • No need to deploy on different servers. • No need to back up. • Number of running instances are scaled automatically. • Google IO is fast. 30
  • 31. GAE: short primer • Wow! What is good about GAE? • Convenient administration tools. • Supports running several versions of your application side-to-side. • Easy to select the default version. • Easy to check stats. • Easy to administer users. 31
  • 32. GAE: short primer • Wow! What is good about GAE? • Super-simple Development SDK: • Provides the environment and two commands: run locally, and deploy. • Easy to run and debug locally using your favorite development tools. 32
  • 33. GAE: short primer DEMO 33
  • 34. AppengineJS: primer • Created by George Moschovits • Build on top of RingoJS (www.ringojs.org). • Built on top of Rhino (JVM-based). • Can be run on GAE! • The foundation is Java. 34
  • 35. AppengineJS: primer • Faithfully implements Python API to GAE. • Python is much closer to JS than Java. • Google’s Python API docs can be used when programming with AppengineJS. • No need to know Java at all. • It never hurts to know some Java. ;-) 35
  • 36. AppengineJS: primer • Internally uses Jack (like Ruby’s Rack) and Nitro (a set of middleware and utilities). • Shipped with an optional normal-template package for simple templating. • Unbelievably simple APIs. 36
  • 37. AppengineJS: primer • Example of a Jack web application: • A function, which takes a request object and returns a response object. function(env) { return { status: 200, headers: {”Content-Type”:”text/plain”}, body: [”Hello, world!”] }; } 37
  • 38. AppengineJS: primer • On top of this simple specification Nitro provides middleware functions. • Middleware is used to pre-process a request and to post-process a response. • Usually middleware is nested like matryoshka. • The inner-most function is a request handler. 38
  • 39. AppengineJS: primer • Following middleware is provided by Nitro out of box: • dispatch() maps a requested path to a handler function. • setup() implements most common operations like content size calculations and so on. • memcache() allows to cache responses. 39
  • 40. AppengineJS: primer • Following middleware is provided by Nitro out of box: • errors() handles exceptions. • render() takes the result data and applies it to a template. • It is super easy to add your own middleware. 40
  • 42. SSJS vs. Browser for devs • Controlled environment: • No need to support legacy JS (like IE). • You can freely use getters/setters. • Array enhancements are available. • Easier to debug. 42
  • 43. SSJS vs. Browser for devs • No need to worry about the download size of programs. • More sophisticated libraries can be used. • JSON translates natively on both sides. • JS techniques translate well to SSJS. 43
  • 44. SSJS vs. Browser for devs • Non-DOM libraries can be reused on both sides. • Big potential to reuse the same code client- side and server-side. Example: • Initial rendering of a page can be done on the server. • Subsequent updates/changes can be done on the client. 44
  • 45. Summary • End-to-end JS solutions have a big potential. This is a viable option for new web projects. • New trends in web development can change the landscape. Keep your eye on it! • There is life beyond virtual machines and hosted solution. Do you homework! • Always evaluate NoSQL for your projects! • JavaScript is fun! 45

Notas del editor