CONTENTS
● Brief Description on:
1. Grape
2. Goliath
3. Eventmachine
4. Fiber
5. Node.JS
6. Node.JS vs EM
● Grape_Goliath ...
GRAPE
● REST-like API micro-framework for
Ruby
● Designed to run on Rack or
complement existing web application
frameworks...
Advantages
● No need of rails to create simple
API's.
● Grape allows you to build lightweight
APIs with Ruby when you don'...
GOLIATH
● Non-blocking Ruby web server
● Serves to requests using a
EventMachine loop.
● Uses a Fiber to process a request.
Significance of Goliath
● Bare metal performance
● Rack API and middleware support
● Simple configuration
● Fully asynchro...
Goliath Advantage
● Major advantage over other frameworks is
that by leveraging Ruby fibers introduced
in Ruby 1.9+, it ca...
..contd
● Each HTTP request within Goliath is
executed within its own Ruby fiber and all
asynchronous I/O operations can
t...
Goliath compared to
other servers like Thin
● Goliath is able to run on different Ruby
platforms.
● It uses a different HT...
..contd
● Goliath claims to works its magic by
“leveraging Ruby fibers introduced in Ruby
1.9+”.
● Fibers are primitives f...
EVENTMACHINE
● EventMachine is an event-driven I/O and
lightweight concurrency library for Ruby.
● It provides event-drive...
EM Significance
● Extremely high scalability, performance and
stability for the most demanding production
environments.
● ...
EventMachine Usage
● Scalable event-driven servers. Examples:
Thin or Goliath.
● Scalable asynchronous clients for various...
FIBERS
● Primitives for implementing light weight
cooperative concurrency in Ruby.
● They are never preempted and that the...
Client Example
Server Example
Node.JS vs EM
Pros and Cons
EM
● Clever DSL
● Also Fast
● Its Ruby
● Mature
● Restricted EM Libraries.
● More difficult to write
than no...
EventMachine Better
than Node.JS?
YES
● EventMachine’s concurrent processing
ability is stronger than Node.js 50%.
● When ...
Gem Grape_Goliath
●
Gem which creates an application with
tree structure specified for a Goliath
application having Grape ...
Basic tree structure
/config
Important Gems Used
Rubigen
● A framework to allow Ruby applications to
generate file/folder stubs.
● RubiGen will be norm...
Generators
● There are two types :
1. Application generators – Used by
developers for the framework to get started.
Genera...
grape_goliath_generator.rb
● Application generator for the gem.
● Its manifest method includes the
directories that are to...
Usage
● grape_goliath application_name
● cd application_name
● bundle install (To install all dependencies)
● ruby server....
Enjoy Grape_Goliath!!
Thank You
Upcoming SlideShare
Loading in...5
×

Grape golilath

869

Published on

Micro-framework for Evented API Servers

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
869
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Grape golilath

  1. 1. CONTENTS ● Brief Description on: 1. Grape 2. Goliath 3. Eventmachine 4. Fiber 5. Node.JS 6. Node.JS vs EM ● Grape_Goliath Gem and Usage
  2. 2. GRAPE ● REST-like API micro-framework for Ruby ● Designed to run on Rack or complement existing web application frameworks. ● Grape APIs are Rack applications that are created by subclassing Grape::API.
  3. 3. Advantages ● No need of rails to create simple API's. ● Grape allows you to build lightweight APIs with Ruby when you don't need the heavy lifting power of large frameworks like Rails.
  4. 4. GOLIATH ● Non-blocking Ruby web server ● Serves to requests using a EventMachine loop. ● Uses a Fiber to process a request.
  5. 5. Significance of Goliath ● Bare metal performance ● Rack API and middleware support ● Simple configuration ● Fully asynchronous processing ● Readable and maintainable code
  6. 6. Goliath Advantage ● Major advantage over other frameworks is that by leveraging Ruby fibers introduced in Ruby 1.9+, it can untangle the complicated callback-based code into a known format. ● Linear execution, leads to more maintainable and readable code.
  7. 7. ..contd ● Each HTTP request within Goliath is executed within its own Ruby fiber and all asynchronous I/O operations can transparently suspend and later resume the processing without requiring the developer to write any additional code. ● Both request processing and response processing can be done in fully asynchronous fashion: streaming uploads, firehose API's, request/response, websockets, and so on.
  8. 8. Goliath compared to other servers like Thin ● Goliath is able to run on different Ruby platforms. ● It uses a different HTTP parser, supports HTTP keepalive & pipelining. ● Offers a fully asynchronous API for both request and response processing.
  9. 9. ..contd ● Goliath claims to works its magic by “leveraging Ruby fibers introduced in Ruby 1.9+”. ● Fibers are primitives for implementing light weight cooperative concurrency in Ruby. Basically they are a means of creating code blocks that can be paused and resumed, much like threads. ● The main difference is that they are never preempted and that the scheduling must be done by the programmer.
  10. 10. EVENTMACHINE ● EventMachine is an event-driven I/O and lightweight concurrency library for Ruby. ● It provides event-driven I/O using the Reactor pattern, much like JBoss Netty, Apache MINA, Python's Twisted, Node.js, libevent and libev.
  11. 11. EM Significance ● Extremely high scalability, performance and stability for the most demanding production environments. ● An API that eliminates the complexities of high-performance threaded network programming, allowing engineers to concentrate on their application logic. ● This unique combination makes EventMachine a premier choice for critical networked applications, including Web servers and proxies, email and IM production systems, authentication/authorization processors, and many more.
  12. 12. EventMachine Usage ● Scalable event-driven servers. Examples: Thin or Goliath. ● Scalable asynchronous clients for various protocols, RESTful APIs and so on. Examples: em-http-request or amqp gem. ● Efficient network proxies with custom logic. Examples: Proxymachine. ● File and network monitoring tools. Examples: eventmachine-tail and logstash.
  13. 13. FIBERS ● Primitives for implementing light weight cooperative concurrency in Ruby. ● They are never preempted and that the scheduling must be done by the programmer and not the VM. ● Small 4KB stack enables it to be paused from deeply nested function calls within the fiber block. ● Run using the Fiber#resume method. The code running inside the fiber can give up control by calling Fiber.yield.
  14. 14. Client Example
  15. 15. Server Example
  16. 16. Node.JS vs EM
  17. 17. Pros and Cons EM ● Clever DSL ● Also Fast ● Its Ruby ● Mature ● Restricted EM Libraries. ● More difficult to write than normal ruby. Node.JS ● Shared Code betweeen Client and Server. ● Lightning Fast ● Javascript used ● Callback Hell ● Less Mature.
  18. 18. EventMachine Better than Node.JS? YES ● EventMachine’s concurrent processing ability is stronger than Node.js 50%. ● When request number goes up, Node.js’s connection rate goes down.
  19. 19. Gem Grape_Goliath ● Gem which creates an application with tree structure specified for a Goliath application having Grape API framework. ● Included Gems in tree structure : grape, goliath, em_synchrony ● Added dependencies of rubigen included.
  20. 20. Basic tree structure /config
  21. 21. Important Gems Used Rubigen ● A framework to allow Ruby applications to generate file/folder stubs. ● RubiGen will be normally integrated into another RubyGem, such as newgem, rails or camping. ● Here we have used newgem. `` NewGem ● Quickly bundle any Ruby libraries into a RubyGem and share it with the world.
  22. 22. Generators ● There are two types : 1. Application generators – Used by developers for the framework to get started. Generally used to generate a basic stub directory files/folders. 2. Component generators - Used by developers to extend their application. ● Here we have used application generator for basic goliath app tree structure generation.
  23. 23. grape_goliath_generator.rb ● Application generator for the gem. ● Its manifest method includes the directories that are to be created and the files that should be inlcuded in the tree structure. ● The files that should get added with specified code are to be included in the templates folder in the path app/application_generator/grape_goliath /templates.
  24. 24. Usage ● grape_goliath application_name ● cd application_name ● bundle install (To install all dependencies) ● ruby server.rb -vs (To run the Goliath server) ● For further info visit: https://github.com/qburstruby/grape_goliath
  25. 25. Enjoy Grape_Goliath!! Thank You
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×