ruby: libraries, frameworks, servers providing concurrency for development of a web based chat [closed] - ruby

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
What ruby concurrency lib/framework should I use for the development of a web based chat?
I have read about Eventmachine and Celluloid libraries, and about Sinatra::Synchrony, Cramp, Goliath and Gserver concurrency-ready-servers. If I am getting this right, all these libs or servers implement concurrency using two main different approaches: the reactor pattern (mostly all of them), or the use of multithreading (i.e. gserver, ...).
Now if this is all correct, and I hope it is, could someone:
correct me if it is not...
point out other actively developed libraries or frameworks that I've missed ?
The reason I am asking this is that I am trying to build, for learning purposes, a web based chat using ruby on server side. It will interact with client using websockets or Server Side Events, with Jquery or something else.
Also I've read about using ruby with a Xmpp server, or pub/sub messaging system (like Faye). If I put one of these in the dish, am I correct if I say if that it all shrinks down to having to worry only about making requests to those servers in a non-blocking way, rather than having to set-up a complete "non-blocking" ruby chat server ?
I know this is a bit convoluted, but I hope it still make sense..
But in case I am going totally the wrong direction about something, can someone please give me at least a general, vague idea of what I need to understand better ?
Thanks!

Funny you should ask. Peter Cooper from Ruby Weekly mentioned (Issue 116 - October 25, 2012) a talk subtitled "Ruby developers need to stop using EventMachine. It's the wrong direction," which spawned some interesting debate on HN, since many frameworks are built on top of it (Goliath, Cramp, etc.)
The disenchanted flock either to Celluloid (with Sidekiq as its most famous client), to the Node.js platform or to other languages that offer solid concurrency primitives from the get go. Yes, Go, Erlang, Clojure...
Personally, I implemented a realtime web-based chat not long ago using Cramp, Redis Pub/Sub and Websockets, loosely adapted from the following demo code. It worked as advertised, but the traffic it gets doesn't compare to the requirements of some high volume systems elsewhere.

Related

Design strategy for Microservices in .NET [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What would be a good way for Microservices .NET to communicate with each other? Would a peer to peer communication be better (for performance) using NETMQ (port of ZeroMQ) or would it be better via a Bus (NServiceBus or RhinoBus)?
Also would you break up your data access layer into microservices too?
-Indu
A Service Bus-based design allows your application to leverage the decoupling middleware design pattern. You have explicit control in terms of how each Microservice communicates. You can also throttle traffic. However, it really depends on your requirements. Please refer to this tutorial on building and testing Microservices in .NET (C#).
We are starting down this same path. Like all new hot new methodologies, you must be careful that you are actually achieving the benefits of using a Microservices approach.
We have evaluated Azure Service Fabric as one possibility. As a place to host your applications it seems quite promising. There is also an impressive API if you want your applications to tightly integrate with the environment. This integration could likely answer your questions. The caveat is that the API is still in flux (it's improving) and documentation is scarce. It also feels a bit like "vendor lock".
To keep things simple, we have started out by letting our microservices be simple stateless applications that communicate via REST. The endpoints are well-documented and contain a contract version number as part of the URI. We intend to introduce more sophisticated ways of interaction later as the need arises (ie, performance).
To answer your question about "data access layer", my opinion would be that each microservice should persist state in whatever way is best for that service to do so. The actual storage is private to the microservices and other services may only use that data through its public API.
We've recently open sourced our .NET microservices framework, that covers a couple of the needed patterns for microservices. I recommend at least taking a look to understand what is needed when you go into this kind of architecture.
https://github.com/gigya/microdot

Design approach for hosting multiple microservices on the same host [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a Web application that I decoupled it in multiple containerized microservices. I have now around 20 services, but the whole system will definitely need more than 300. Most of the services now and some in the future will not need an entire machine so I'll deploy multiple services on a same host. I'm wondering how others deal with interservice communication. My preferred way was to go with a REST based communication but...
Isn't it too heavy to have multiple web servers running on the same machine? I'm developing in Ruby, but even a lightweight web server like Puma can consume a good amount of memory
I started writing a custom communication channel using UNIX sockets. So, I'd start one web server and my "router" app would communicate with the currently running services on that host through UNIX sockets. But I don't know if it's worth the effort and on top of that, all services have to be written and customized to use this kind of communication. I believe it would be hard to use any framework like Ruby-on-Rails or others, even different languages which is the whole appeal with microservices architecture. I feel like I'm trying to reinventing the wheel.
So, can someone suggest a better approach or vote for one of my current ones?
I appreciate any help,
Thanks,
Looks like you may want to look into docker swarm, they're actively working on these use cases. I wouldn't recommend building your own communication channel, stick with http or maybe use spdy if you're really concerned about performance. Anything you introduce will make using these upcoming solutions more difficult. Also keep in mind you don't need a heavy-duty web server in most cases, you can always introduce a layer above one or more of your services using nginx or haproxy for example.

Looking for an XMPP server library written in Ruby [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am in the process of building a web based chat app written in Ruby. I would like to provide the ability to also connect to this chat server using an XMPP client. So I am looking for a library that will handle being a real XMPP server which I can tie into with my existing Ruby code (or by using something like Redis in between). However, I am having a hard time finding the server library (though I can find many libraries for acting as a client which consumes or interacts with the server). I'm also not very experienced with XMPP to begin with so I may be asking for the wrong thing. Do you know of an XMPP server library I can use?
XMPP server libraries generally don't make much sense, as XMPP servers (like HTTP servers for example) run as separate standalone long-lived processes. You don't usually embed them into your application.
XMPP is even a step further from HTTP - there are HTTP server libraries that allow you to listen on a port, wait for requests, and send a response. XMPP is completely different in this aspect - XMPP sessions are long-lived, and require constant attention. Using an XMPP server library your application would spend most of the time inside that library - at which point, why isn't it as good as running a separate process?
I know it's a tempting idea, but having developed an XMPP server and thinking about this (people have requested it before you) I just concluded it made very little sense (even if it is technically possible).
Many XMPP servers allow custom plugins for integration with other systems, and there are servers in Ruby if that's a requirement for you (e.g. Vines).
Try XMPP4R
For example - connection and authentication:
require "xmpp4r"
robot = Jabber::Client::new(Jabber::JID::new("sample#xmpp.ru"))
robot.connect
robot.auth("password")
And sending message:
message = Jabber::Message::new("recipient#xmpp.ru", "Hi there!")
message.set_type(:chat)
robot.send message
But the library is somewhat unstable under Windows, but great in Linux.
There is also XMPP server implementation under Ruby using XMPP4R - http://code.google.com/p/xmpp-rserve/
EDIT
Maybe this is what you want. Looks like a library suitable for server usage - https://github.com/sprsquish/blather
Found it on XMPP official page - http://xmpp.org/xmpp-software/libraries/

Node.js MVC framework [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I would like to use Node.js to develop a website. I've seen a lot of frameworks here: https://github.com/joyent/node/wiki/modules#web-frameworks-micro but do not know which one is the most accepted by the community (let's say: the most popular). Did anyone tried any of these frameworks and/or used it in production and what is your experience? Thanks.
Express.js seems to very popular to use as a general framework. Combined with socketio.js and underscore.js these are very popular libraries but they are not MVC.
For MVC I've only used backbone.js / spine.js and can't give any recommendation for the others. I don't think there is a framework with a dominating popularity going yet because node.js doesn't have much use in production.
There are statistics for popular downloads with npm somewhere. See if you can find them.
Another great MVC framework that is up and coming is Sails.JS. It is inspired by ruby on rails and has features such as socket support, Restful API and more.
http://www.sailsjs.com/
Try RailwayJS. CompoundJS
RailwayJS seems to have been killed and replaced with CompoundJS.
There's a guide for anyone that started with Railway and wants to migrate to Compound.
I just released Locomotive, which is an MVC framework inspired by Ruby on Rails.
Express is phenomenal, especially for smaller apps. Recognizing that, Locomotive is built completely on top of Express (similar to how Express builds on top of Connect). Locomotive essentially adds a controller layer along with a router that can declare resourceful routes and generates routing helper functions. Internally, everything is powered by Express, which means the view layer remains the same and all middleware can be reused.
One of the bigger hurdles when learning Node is figuring out how to best structure a web application. Locomotive attempts to solve that problem, using conventions from Ruby on Rails, while retaining the full power of Express and Node.
There is matador. It is MVC and it consists of many different existing components, such as Klass for inheritance model, express, hogan.js, and valentine. Backbone.js is pretty much used for client side. For node, i think there's probably only matador that I know.
I'd suggest you against using it if you're to use matador for production or replace your existing MVC platform (or at least have a bottleneck/good reason to use it) since it's pretty new, and your productivity also depends on the javascript resources you have. We ourselves use node.js very extensively (our node.js deployment serves close to +4 Million users to date) and we have a significant number of javascript specialists here..so we experiment a lot and probably look into using matador soon. Hope that helps.
Geddy was the original MVC framework for Nodejs, check out http://geddyjs.org if you're interested.
Just came across a new one called Derby which looks like it has a lot of promise. Its main benefit seems to be that it cuts down on a lot of the "glue code" (as they put it) that we often write when trying to use rails and backbone, or django and backbone together. The documentation seems pretty decent for a node framework as well.
Monorail.js - Ultra lightweight MVC Framework for Node.js
https://github.com/runexec/Monorail.js
There are a few more frameworks which you could check:
ThinkJS https://thinkjs.org/ the first Node.js MVC framework that can use full ES6/7 features to develop Node.js application.
Feathers http://feathersjs.com/ a minimalist real-time framework.
Meteor https://www.meteor.com/
Keystone.js http://keystonejs.com/ built on Express and MongoDB (MIT license).
seneca.js http://senecajs.org/ Everything external to a business logic - such as databases, caches and third-party integrations - is hidden behind microservices.
Catberry http://catberry.org/ was developed to help create apps that use the same codebase on both the server and client environments to render what the client would see as a "Single Page Application".
Nuke.js http://nukejs.com/#/ Fast framework. The stack contains primus, express, mithril, mongodb and redis
Hapi.js http://hapijs.com/ rich web application server framework for Node.js.
total.js https://www.totaljs.com/ The framework contains full web server, view engine, SMTP mail sender, localization, image processing, websockets, isomorphic code and a lot of utilities

Graphical HTTP client for windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am looking for a Windows graphical utility for performing HTTP operations.
For example, I want to be able to say things like:
POST to http://example.org/test/service
With a POST body: "Data goes here"
Does anyone know a good piece of software for doing this?
I too have been frustrated by the lack of good graphical http clients available for Windows. So over the past couple years I've been developing one myself: I'm Only Resting, "a feature-rich WinForms-based HTTP client." It's open source (Apache License, Version 2.0) with freely available downloads.
It currently has fairly complete coverage of HTTP features except for file uploads, and it provides a very good user interface with great request and response management.
Here's a screenshot:
Update: For people that still come across this, Postman is your best bet now: https://www.getpostman.com/apps
RestClient is my favorite. It's Java based. I think it should meet your needs quite nicely. I particularly like the Auth suppport.
https://github.com/wiztools/rest-client
Have you looked at Fiddler 2 from Microsoft?
http://www.fiddler2.com/fiddler2/
Allows you to generate most types of request for testing, including POST. It also supports capturing HTTP requests made by other applications and reusing those for testing.
You can use Microsoft's WFetch tool also. This is a good tool for all HTTP operations.
You could try Jsonium tool http://jsonium.org- nice free tool specialized on requests with JSON in bodies and responses
http://www.ieinspector.com/httpanalyzer/
http://www.microsoft.com/downloads/details.aspx?FamilyID=B134A806-D50E-4664-8348-DA5C17129210&displaylang=en
https://addons.mozilla.org/en-US/firefox/addon/9780/
http://soft-net.net/SendHTTPTool.aspx
https://addons.mozilla.org/en-US/firefox/addon/966/
Honestly, for simplistic stuff like that I typically whip up a quick HTML form in a local file and load that up in a browser.
I like rest-client a lot for the purposes you described. It's a Java application to test REST-based web services.
If anybody is still interest Eclipse Labs Rest Client tool is an excellent choice. I'm trying it in Windows in an EXE version and works smoothly.
I've worked also with Rest Client previously and its great too.
https://play.google.com/store/apps/details?id=com.snmba.restclient
works from Android Tablets & Phones. Flexible enough to try various combinations.

Resources