SlideShare ist ein Scribd-Unternehmen logo
1 von 62
LinkedIn Mobile
Lessons from Building
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/linkedin-html5-nodejs

InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Presented at QCon San Francisco
www.qconsf.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Simple
Fast
Easy
Reliable
Product & Design

Development Background
Our Choices
Server

Client
Product & Design
It impacts engineering
Websites vs. Applications
Content Focus

Flow & Action Focus

Long Form Layout

Lists/Details

Responsive Design
Good for websites; Not for applications
Interaction vs. Visual
• Design a house floor plan
• Focus on Rooms and Hallways
• Stay away from Paint, Furniture Carpet

• Has & Does for each screen
• Black & White then Color
Adjust App Platforms
• On Screen vs. Hardware Back
• Up vs. Back / Stacks vs. Pages
• Pull to Refresh vs. Button Refresh
• Settings Room Location
• Visual Design
Development Background
Approach to Engineering
HTML5 vs Native
• What is the skillset of the team?
• What is your front door?
• Which platforms are you targeting?
• Phone Gap vs Titanium vs XXX
Libs vs. Frameworks

Frameworks call
your app
(Few)

App call libraries
(Lots)
Process vs Evented
Systems
Process Systems
Single process/thread per request
Block while waiting for I/O to complete
Use Process/Thread Pools
Evented Systems
Single Process for large number of requests

Non Blocking for I/O
Use 1 Process per Core on system for scale
Evented For Mobile
Process Systems great for high compute
Evented Systems great for I/O bound

With mobile client rendering,
evented systems best for front end
Our Choices
Phone

Tablet

Screen

Screen

Screen

Screen

Controller

Controller

Controller

Controller

View

View

View

View

Client/Server Border

Phone Server

LinkedIn API Layer

Tablet Server
1 Server / App
Touch

Mouse/
Keyboard

Large

X

X

Small

X

?
Screen Based JSON
•

Single Request per
screen

•

JSON is template
based

•

Updatable on
server

{
ttype: nut1,
time: 298349823,
header: “Wow, that is pretty cool”,
.......
......
footer: “shared by Kiran Prasad”,
id: 1298398127,
}
Implications
• Caching Control
• Session Management
• Front-end Server Scale
• Code - Build - Test - Deploy
Caching
• Move server’s page and session caches
• Store server responses in Local Storage
• Manage your own image cache for assets
• Store the app (JS/HTML/CSS) in local storage
• Double render for perceived speed
Massive reduction in memory footprint of server

URL => Response

Base64 Encode Assets and store for more granular cache control

Diff Match Patch for updates
Sessions
•

Store on the client side

•

Client Controllers have state

•

Limited state transferred across net

•

Stateless server that is memory light

•

Stateless Server horizontally scallable

Store in local storage come back on upgrade/restore
Fast decisions of best screen without server roundtrip
No cookies going back and forth to carry state
No memory/stable session store => lighter processes
Easy replication even to other data centers
Front-End Scale
150qps in 60MB Ram

Bound
• I/O Bound vs ComputeLess actual CPU work
More waiting on Backend,
Process based
• Evented oversince mostly I/O blocked
Using Node.js
footprint light
• Memory or session or page rendering
No cache

• Ping/Pull Model viablemuch simpler
Websocket’s for updates
Mobile Web
Screen vs Page
• App is multiple Screens in one page
• Page is a browser Page and has an implication
of JS Load/Parse time
• Screen to Screen move is div show/hide
Backbone.js
• Controls Routing from Screen to Screen
• Controls Screen lifecycle (load, show, hide)
• Controls View Updating based on Model
Change
• Has Model construct for Validation
• BaseRouter to Backbone
– Transitions, screen life cycle

• M V C links in Backbone lead to mem leaks
Libraries
• Zepto – Manipulate the DOM
• Underscore – Collection helpers and binding
constructs, templating
Build / Packaging
• Closure
– Minify, Comment Removal, Template Compilation

• SASS
– Variables, Functions, Selector Inheritance

• Bundle (set of screens)
– Local, Template, Controllers/Views

• Build independently and resuable
Startup
• Initial
–
–
–
–

Index.html
List of bundle files
Store all in Local Storage
Backbone starts home bundle

• Upgrade
–
–
–
–

Index.html
MD5 has for each file
Compare/Download Diff
Store in Local Storage
Tools / Gotchas
• Chrome Memory Profiler
– https://developers.google.com/chromedeveloper-tools/docs/heap-profiling

• Memory Leak Tracking
– http://gent.ilcore.com/2011/08/finding-memoryleaks.html

• Hardware Acceleration for DIV render only on
screen DIV’s
• Double Render from Cache
FAQ - Slideshare

http://www.slideshare.net/phegaro

• What/Why for server tech? Node.js
• How much layout in screen based
template?

• What are good tools for HTML5
Development?
Appendix
Mobile Server
•
•
•
•
•
•
•
•

Scaling Node
Node Modules
Logging vs Tracking vs Metrics
File Structure / Code Size
Client / Server Line Format
Server / Server Line Format
Latency vs Bandwidth
Gotchas
Scaling
• Load Balancer talking to each node instance
running on separate cores
• In Node .8, finally have master/child file
handle sharing based evented model
• 150 qps per core per instance
• 60 MB of RAM for an instance
Node Modules
•
•
•
•
•

Step to Q
Express/Connect -- Framework
Vows to Mocha
Request
Underscore to loDash
Logging/Monitoring/Tracking
• Logging used for sending lots of text information
– useful for debugging

• Monitoring is for sending counters for realtime
monitoring: Product and System
– Typical: Query Rate, Response Code, Time for request,
Page Views, Actions
– Cube from Square

• Tracking is for product metric queries
– Get into a database for queries
– Needed for doing Uniqing and Pathing queries
File Structure / Code Size
• Follow simple Rails/Django dir
– Controllers, Helpers, Formatters, Templates
– No Views, No Models

• Code Size ~ 10K
Client / Server Line Level
•
•
•
•

Single Request per screen
JSON is template based
Updateable on Server
Don’t add:
– Links
– Styles
– Positioning

• Node is part of the client
NOT the server
Server / Server Line Level Format
• Stream Data
– Metrics, Logging, Events, etc
– Kafka, Thrift, Avro, Protocol Buffers etc.

• Request/Response Data
– HTTP/JSON
– REST Endpoints for actual data models
– Not much faster for performance
Latency vs. Bandwidth
• Latency is the issue with mobile not
bandwidth
• Establish and keep the socket open for ping
• Use a ping and pull model not a true push
• Easier to scale ping/pull model
Node Gotchas
• Exception Handling
• Don’t listen on startup till you are connected
to down stream services
• Okay to die and respawn
• httpClient.agent = false
• Turn on console in production
• NO BLOCKING!
Client
Native for Infinite Scroll

Native for Window Manger
HTML5 for everything else
iOS / Android Native
Native Gotchas
Web to Native Messaging

Cache/Image Management
Tools / Test
Web to Native Messaging
• iFrame with URL for Ping
• Native Pulls from Queue
• Web-Sockets suck

• REST for Native Services
Cache/Image Management
• Store all data in url/result hash
• Render data from Hash
• Render again from server response
• Image src should be set to small image when
off screen
Tools/Test
•
•
•
•
•
•
•
•

iWebInspector / Weinre
Charles Proxy for req debugging
Pain when OS upgrade
Selenium with Safari Simulator (Web Parts)
Instruments UIAutomation / Robotium (Native)
Layout Test: DumpRender + ImageDiff (5%)
Vcr.js – Fixture Creater
Android Emulator Super Slow to have to do on
build machine with catchup
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/linkedinhtml5-nodejs

Weitere ähnliche Inhalte

Mehr von C4Media

Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsC4Media
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechC4Media
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaC4Media
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayC4Media
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?C4Media
 

Mehr von C4Media (20)

Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in Adtech
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?
 

Kürzlich hochgeladen

Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Kürzlich hochgeladen (20)

Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Lessons from Building LinkedIn Mobile - HTML5 & Node.js

  • 2. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /linkedin-html5-nodejs InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month
  • 3. Presented at QCon San Francisco www.qconsf.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 8. Product & Design Development Background Our Choices Server Client
  • 9. Product & Design It impacts engineering
  • 10. Websites vs. Applications Content Focus Flow & Action Focus Long Form Layout Lists/Details Responsive Design Good for websites; Not for applications
  • 11. Interaction vs. Visual • Design a house floor plan • Focus on Rooms and Hallways • Stay away from Paint, Furniture Carpet • Has & Does for each screen • Black & White then Color
  • 12.
  • 13. Adjust App Platforms • On Screen vs. Hardware Back • Up vs. Back / Stacks vs. Pages • Pull to Refresh vs. Button Refresh • Settings Room Location • Visual Design
  • 14.
  • 16. HTML5 vs Native • What is the skillset of the team? • What is your front door? • Which platforms are you targeting? • Phone Gap vs Titanium vs XXX
  • 17. Libs vs. Frameworks Frameworks call your app (Few) App call libraries (Lots)
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 25. Process Systems Single process/thread per request Block while waiting for I/O to complete Use Process/Thread Pools
  • 26. Evented Systems Single Process for large number of requests Non Blocking for I/O Use 1 Process per Core on system for scale
  • 27. Evented For Mobile Process Systems great for high compute Evented Systems great for I/O bound With mobile client rendering, evented systems best for front end
  • 28.
  • 31. 1 Server / App Touch Mouse/ Keyboard Large X X Small X ?
  • 32. Screen Based JSON • Single Request per screen • JSON is template based • Updatable on server { ttype: nut1, time: 298349823, header: “Wow, that is pretty cool”, ....... ...... footer: “shared by Kiran Prasad”, id: 1298398127, }
  • 33. Implications • Caching Control • Session Management • Front-end Server Scale • Code - Build - Test - Deploy
  • 34. Caching • Move server’s page and session caches • Store server responses in Local Storage • Manage your own image cache for assets • Store the app (JS/HTML/CSS) in local storage • Double render for perceived speed Massive reduction in memory footprint of server URL => Response Base64 Encode Assets and store for more granular cache control Diff Match Patch for updates
  • 35. Sessions • Store on the client side • Client Controllers have state • Limited state transferred across net • Stateless server that is memory light • Stateless Server horizontally scallable Store in local storage come back on upgrade/restore Fast decisions of best screen without server roundtrip No cookies going back and forth to carry state No memory/stable session store => lighter processes Easy replication even to other data centers
  • 36. Front-End Scale 150qps in 60MB Ram Bound • I/O Bound vs ComputeLess actual CPU work More waiting on Backend, Process based • Evented oversince mostly I/O blocked Using Node.js footprint light • Memory or session or page rendering No cache • Ping/Pull Model viablemuch simpler Websocket’s for updates
  • 37.
  • 39. Screen vs Page • App is multiple Screens in one page • Page is a browser Page and has an implication of JS Load/Parse time • Screen to Screen move is div show/hide
  • 40. Backbone.js • Controls Routing from Screen to Screen • Controls Screen lifecycle (load, show, hide) • Controls View Updating based on Model Change • Has Model construct for Validation • BaseRouter to Backbone – Transitions, screen life cycle • M V C links in Backbone lead to mem leaks
  • 41. Libraries • Zepto – Manipulate the DOM • Underscore – Collection helpers and binding constructs, templating
  • 42. Build / Packaging • Closure – Minify, Comment Removal, Template Compilation • SASS – Variables, Functions, Selector Inheritance • Bundle (set of screens) – Local, Template, Controllers/Views • Build independently and resuable
  • 43. Startup • Initial – – – – Index.html List of bundle files Store all in Local Storage Backbone starts home bundle • Upgrade – – – – Index.html MD5 has for each file Compare/Download Diff Store in Local Storage
  • 44. Tools / Gotchas • Chrome Memory Profiler – https://developers.google.com/chromedeveloper-tools/docs/heap-profiling • Memory Leak Tracking – http://gent.ilcore.com/2011/08/finding-memoryleaks.html • Hardware Acceleration for DIV render only on screen DIV’s • Double Render from Cache
  • 45. FAQ - Slideshare http://www.slideshare.net/phegaro • What/Why for server tech? Node.js • How much layout in screen based template? • What are good tools for HTML5 Development?
  • 47. Mobile Server • • • • • • • • Scaling Node Node Modules Logging vs Tracking vs Metrics File Structure / Code Size Client / Server Line Format Server / Server Line Format Latency vs Bandwidth Gotchas
  • 48. Scaling • Load Balancer talking to each node instance running on separate cores • In Node .8, finally have master/child file handle sharing based evented model • 150 qps per core per instance • 60 MB of RAM for an instance
  • 49. Node Modules • • • • • Step to Q Express/Connect -- Framework Vows to Mocha Request Underscore to loDash
  • 50. Logging/Monitoring/Tracking • Logging used for sending lots of text information – useful for debugging • Monitoring is for sending counters for realtime monitoring: Product and System – Typical: Query Rate, Response Code, Time for request, Page Views, Actions – Cube from Square • Tracking is for product metric queries – Get into a database for queries – Needed for doing Uniqing and Pathing queries
  • 51. File Structure / Code Size • Follow simple Rails/Django dir – Controllers, Helpers, Formatters, Templates – No Views, No Models • Code Size ~ 10K
  • 52. Client / Server Line Level • • • • Single Request per screen JSON is template based Updateable on Server Don’t add: – Links – Styles – Positioning • Node is part of the client NOT the server
  • 53. Server / Server Line Level Format • Stream Data – Metrics, Logging, Events, etc – Kafka, Thrift, Avro, Protocol Buffers etc. • Request/Response Data – HTTP/JSON – REST Endpoints for actual data models – Not much faster for performance
  • 54. Latency vs. Bandwidth • Latency is the issue with mobile not bandwidth • Establish and keep the socket open for ping • Use a ping and pull model not a true push • Easier to scale ping/pull model
  • 55. Node Gotchas • Exception Handling • Don’t listen on startup till you are connected to down stream services • Okay to die and respawn • httpClient.agent = false • Turn on console in production • NO BLOCKING!
  • 56. Client Native for Infinite Scroll Native for Window Manger HTML5 for everything else
  • 57. iOS / Android Native
  • 58. Native Gotchas Web to Native Messaging Cache/Image Management Tools / Test
  • 59. Web to Native Messaging • iFrame with URL for Ping • Native Pulls from Queue • Web-Sockets suck • REST for Native Services
  • 60. Cache/Image Management • Store all data in url/result hash • Render data from Hash • Render again from server response • Image src should be set to small image when off screen
  • 61. Tools/Test • • • • • • • • iWebInspector / Weinre Charles Proxy for req debugging Pain when OS upgrade Selenium with Safari Simulator (Web Parts) Instruments UIAutomation / Robotium (Native) Layout Test: DumpRender + ImageDiff (5%) Vcr.js – Fixture Creater Android Emulator Super Slow to have to do on build machine with catchup
  • 62. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/linkedinhtml5-nodejs