Locking Data Structures in Distributed Systems [closed] - algorithm

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 8 years ago.
Improve this question
I am entirely new to the concepts of distributed systems. Kindly let me know even if the question should be rephrased.
I am trying to make a distributed systems with 10 clients and one server. There is a queue at server side, that can be accessed by clients one at a time. So what kind of locking mechanism could be used so as to avoid spurious data? Are semaphores feasible in this situation? If possible, kindly provide a reference, so as to have a much deeper knowledge of the same.

Semaphores on the server are feasible, and indeed are the way to go. On a GNU/Linux system such as Debian, see man 7 sem_overview and man 1 lockfile.
The simplest method is probably to let the server serve no more than one client at a time, refusing all requests from other clients. A refused client waits a random (not definite) length of time, then tries again.
Another method can be to let the server queue requests, but this is more complicated (and may still involve refusing some requests).

Related

Differences between JMeter and Apache Benchmark [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
I've been using JMeter for a long time and during my research, I came across Apache Benchmark, which seemed a bit more simple load testing tool to me.
So my assumption is that; Apache Benchmark is more suitable choice for benchmarking one API at a time. And it won't be a good choice -and maybe impossible- for performing an end-to-end load test.
But I am also curious about if A/B has any kind of advantages over JMeter in terms of performance / benchmark testing.
Could you please explain?
Thanks...
When it comes to "hammering" the endpoint with simple HTTP Requests ab can be suitable alternative to JMeter as long as you're fine with the following limitations:
no control regarding how connections are used/re-used
no support of other authentication types than Basic (digest, NTLM, Kerberos)
no control of DNS caching
no clustered mode of tests execution
missing metrics like connect time, TTFB, etc. and in general results are quite "poor" comparing to JMeter's HTML Reporting Dashboard
The only advantage of ab I can think of is lower CPU/Memory footprint

Golang websocket client [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 2 years ago.
Improve this question
I want to make client websocket connections to exertnal server each connection = goroutine and reader. I was looking informations on the internet but I found how to create server websocket tutorials.
Can anyone be so kind and make a trivial example and walk me through. I am using standart golang libary https://golang.org/x/net/websocket.
I created some code but when I closed one connection program exited with EOF information. I won't post the code because it's probably bad duo to the fact it was my first try.
I know how to read/send message from websocket but I don't know how to create multiple connections.
Any informations, examples would be appreciate, thanks for reading
You can use the Gorilla WebSocket library
Here's an example of it's use as a client
Golang official doc recommends to use gorilla for building websocket based application. Still the problem is, gorilla websocket is not event based. Applications need to handle concurrent read and write operations. Developers need to write custom goroutines for handling connect, disconnect and read events.
I think it is better to have a library handling everything for you.
So, I decided to write down my own client implementation - gowebsocket on top of gorilla. You can find more detailed explaination here Getting started with websocket client in go
You can check the comparison given on this link.
https://yalantis.com/uploads/ckeditor/pictures/4265/websocket-libraries.png
Article suggests to go for Gobwas(https://github.com/gobwas/ws). Its best performance wise and offers all the required features needed for websockets related applications.

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.

how to find memory leaks in java based web application using jmeter? [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 9 years ago.
Improve this question
I am new to jmeter. We have developed a java based web application using spring framework. We want to know whether we can find memory leaks using jmeter.
You can run a JMeter script for a few hours to create the load together with an Application Performance Monitoring solution like New Relic to look for memory leaks.
JMeter is not primary designated to find memory leaks. In few words the main rule of JMeter is request URLs so many times as you required and evaluate results you get back. That explanation is a bit simply and JMeter is really more complex then just this case. However if you guess you've a memory leak in your application, it can be useful in some cases to use JMeter just for to generate many request. However finding memory leaks IS NOT JMeter functionality. You have to monitor you application with some other tools (e.g. jmap, jvisualvm, etc.) and use JMeter just for to generate required specific requests.

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.

Resources