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

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.

Related

Is it good to keep microservices with single technology or multiple? [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 1 year ago.
Improve this question
What is the recommended approach to decide the technology to use for creating miroservice?
ex: All 50 microservices running in .NET platform using SQL Server as
DB for each one of them
OR
Mix and match between different technology
ex : 15 Spring-based microservice with MongoDB, 15 .NET with SQL, 20 NodeJS microservice with Redis
Microservice with different technology
I know this will again come down to developers who are familiar with what technology but all I am looking to know is which approach you would have taken if you have more than 50 microservices.
It really depends on the role of each microservice. If all of them are REST APIs with a pretty similar functionality (but completely different scope), then it would be helpful to use the same tech stack, because:
You can optimize your development workflows
You get more homogeneity across your entire system, which translates into a number of benefits down the road (identify/fix issues faster, optimize resource usage, etc).
However, if you have some microservices which have different constraints in terms of performance (or consistency, or any other vector), you can use a different tech stack just for that one. The architectural model of microservices allows that - it doesn't matter what's behind a microservice as long as it exposes an API that can be used by other microservices.
TL;DR - if you have strong reasons to use different tech stacks for some microservices, you should do it, but keep in mind that it doesn't come without a cost.

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

looking for Best guidance for WCF best performance testing [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 9 years ago.
Improve this question
when some one developing wcf service which will be consumed and used by thousand of people then what are the key point we need to keep in the mind to design web service which will deliver best performance. so please give me all the best tips to design wcf service which can help service to give best performance. thanks
another question what are tools and technique is used in the industry to test the performance of wcf service before hosting in production server. thanks
As for the design, make sure that service is (ok , cliches but still worth to mention)
Easy to scale
Stateless (Per-Call)
Uses no locks
Caches data
Well in general it should be "just" highly performant but it of course depends on your use-cases so it is more important that you know how your users will use the system :
you wrote thousand of people but you should have exact numbers defined
will the service will be used only on certain hours ? If so , maybe it's possible to compute / cache any data that will be heavily used before ?
what is the required throughput /number of calls per sec / avg. number of users working ?
what about peak volumes ? Is it used constantly or it's just users loading data at one time and then nothing ?
where is it going to be hosted ? IIS or self-hosted ? Can you control it ? How is the security plugged int ? Is security a concern ?
who calls your service ? Is SOAP ok ? Can you use REST ?
So the point is that to get best performance you need to have clearly defined goals like "I want to handle 1000 calls per sec and each call uses around 2MB of data" :)
As for the tools a best one is something that resembles your end-users so for final testing it could be a bunch of selenium tests and for perf testing even a console application spamming your endpoints will work but a key factor here is separation so that your services are hosted on different server then test-client

How do I do capacity test a websocket server? [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 6 years ago.
Improve this question
I am looking to capacity test my websocket server but don't really know where to start?
I am able to write a AI that will send messages to test the usage, but how would I simulate/make 100, 500, 1000 connections etc...?
I had a similar problem a little while ago when I had to load test thousands of connections against a server using the socket.io library. I was not able to find any off-the-shelf-solutions to do this so in the end I ended up building my own test using Node.js and a few for loops.
The advantage of Node is you can pretty much copy and paste the client side javascript into your server code so it's pretty simple to simulate the client and then you only need to make multiple connections to generate load. It's a quick and easy way to run the required javascript to establish the socket connection (assuming this is how you connect to your socket).
The gotcha I hit was running more than 600 listeners tended to max out the CPU on my node box but a little bit of AWS magic solved that.
Another issue is reporting results. There's not really any concept of response time with a socket connection, at least not in the classic sense, so it's hard to know when things are going wrong - at least from the client side perspective. But from monitoring the server we were able to see when connections failed and when resources started to get scarce and this was enough for us to benchmark how many connections it could support.
Autobahn Testsuite was designed to meet that need but the performance section of the tool still says "Under Development".
You could use JMeter for this purpose and get the WebSocket sampler plug-in from here: http://github.com/maciejzaleski/JMeter
For that many connections 1000 you might need to get more than one agent machine to achieve your task. This doesn't necessarily have to be dedicated server as you could deploy agents on few workstations (developers/testers machines) and used them for your test purpose. You could limit the impact by scheduling test execution to run out-of-hours.
Jmeter plugin is having severe limitations with number of concurrent users. It was working well only till ~450 users. Then I tried with artillery library(https://artillery.io/docs/testing_websockets.html) but this library also has restrictions with loops with their web socket package.

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

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.

Resources