Week8 Slides
Week8 Slides
Application ● Mechanisms
Frontends ●
●
Asynchronous updates
Browser / Client options
● Client-side computation
● Security implications
Mechanisms
What is the application frontend?
● User-facing interface
○ General GUI application on desktop
○ Browser based client
○ Custom embedded interface
● Device / OS specific controls and interfaces
● Web browser standardization
○ Common conventions among multiple browsers on how to render, what to render
● Browser vs. Native
○ Look and feel
○ APIs, interfaces, interaction
Web applications
● Typical web-browser:
○ issue requests, wait for response
○ render HTML
○ wait for user input: most time spent waiting here
● Why not let client do more?
○ Also allows more fancy interactions
● Client-side scripting
○ Javascript de facto standard
○ Component frameworks allow reuse, complex interactions
○ Server-side Javascript! NodeJS
Tradeoffs
https://serverguy.com/comparison/apache-vs-nginx/
● Static pages:
○ Apache: ~ 10,000 req/s - 512 parallel requests
○ Nginx - ~ 20,000 req/s - 512 parallel requests
● Dynamic (call out to PHP - limited by page rendering in PHP):
○ Both ~ 100 req/s @ 16 parallel
● Dynamic occupies more resources for longer - harder to scale
● Severe impact on server
Asynchronous
Updates
Original web
Accessibility:
● Chrome/Chromium/Brave/Edge: V8
● Firefox: SpiderMonkey
● Safari, older versions of IE use their own
Impact
https://brython.info/
Problems with alternatives
● WebAssembly
● Binary instruction format
● Targets a stack based virtual machine (similar to Java)
● Sandboxed with controlled access to APIs
● “Executable format for the Web”
● Handles high performance execution - can translate graphics to OpenGL etc.
Emscripten
● Compiler framework: compile C or C++ (or any other language that can target
LLVM) to WebAssembly
● Potential for creating high performance code that runs inside browser
● Limited usage so far
https://emscripten.org/index.html
Native Mode
● File system
● Phone, SMS
● Camera object detection
● Web payments
https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
Inbuilt HTML5 form controls
https://developer.mozilla.org/en-US/docs/Web/API/Constraint_validation
Solution