Akka message throttling [closed] - scala

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am trying to implement following scenario with Akka but hitting heap limitations (out of memory errors):
User uploads a text file(25mb aprox) containing around 1000000 lines.
After file gets uploaded HTTP 200 OK is sent back to the client and file processing is starting in the background.
Each line should be processed (saved to the database and external web service call should be made to look up the contents of the line with database update if lookup returned some results.)
Please suggest the approach/pattern.
Many thanks in advance!

There are several ways for achieve this, for example:
1) Use bounded mailbox for some of your actors, then your code that send messages to such actors will block if the target mailbox is full;
2) Use work pulling model when some of your actors will "ask" for more work when idle.

Related

How can i send object/instance of a class from an application on one machine to another application in different machine in swift? [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 2 months ago.
Improve this question
I am working on a MacOS cocoa application using swift from which i have to send information using an object to another application on different machine which then use the information in it's code.
I am new to swift and sorry for my english if you don't to get it.
I have no idea how to do this. Please help me with this if anyone knows.
Well just so you know network communication can be pretty hard. I believe the easiest way is to use WebSocket, which establish a pipe of communication between two devices. You can then send any data you want over this socket.
One difficulty is for the devices to find one another : do they know each other's IP address ? Are they on the same local network ?
The second step is to decide what data you want to send. The simplest is to send JSON content which can be serialized / deserialized on each end easily.
Checkout :
tutorial for websocket
JSON Serialization

Handling Dependency 4XX in REST [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 3 years ago.
Improve this question
I am wondering what would be the appropriate error code to bubble upto my clients when I get 4XX from my dependencies. Say for example, one of my downstream services returns to me a 401 code. This means my own server was not authorised for this request. How should I bubble this information to my clients? Would 424 be the appropriate code to bubble up? I read that it was added to HTTP as an extension, so is it recommended to use it?
Status codes from extensions can be used when properly registered and sufficiently defined.
That said, a 4xx seems to be incorrect here. If your server is not configured properly to access a back end, that's a server error, thus a 5xx.

How many connections can maintain a server and how to know it? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am searching about how many connections can manage a server, I don't have any idea how to filter in google about it, even it would be fantastic if I could simulate an amount of queries and check by my self how many connections are possible
Thanks
I believe there are 6 available "pipes" when requesting resources from a server; such as, six images come through at a time to help populate a web page. However network speed ultimately determines efficiency of this. There are ways to increase the resources pulled by utilizing services such as Content Delivery Networks (CDN) to serve up only the images for example or a particular sub-domain to serve up query calls.
While the above may be out this scope, I came across this answer regarding concurrent user connections to an Apache server and how to manage counts.

How to implement or use a WebSocket in perl? [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 8 years ago.
Improve this question
I need to have 3 major things from perl and don't know how to go about it.
Non Blocking websocket implementation like mojo.
The server needs to accept broadcast calls after it has started
The server needs to be able to access data that is on a different thread.
I have tried mojo but didn't find a way to control the port (I can live with that) and didn't figure out how to call events after the server has started. I wasn't able to test if it could handle events after the fact.
I have tried Net::WebSocket::Server but it is blocking. I am tempted to wrap my own code around it so that it can handle non blocking and shared data as it is by far the simplest implementation and easy to modify.
I have also tried pocket.io but it didn't have a very easy way to implement OO design and still remain thread safe. (Mostly because of the Plack framework).
Does anyone have a good example of how to do this with Mojolicious or pocket.io? If not I will just have to implement my own implementation.

Is a Data Stream a Sequence of Memory Addresses like an Array? [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 8 years ago.
Improve this question
I've read a lot of books and articles mentioning data streams, which I've used mostly in Java, and none of them really mention exactly what a data stream is under the hood. Is it data aligned in memory consecutively as bytes?
Bonus question: What about a socket? How is it represented in memory exactly and how is it connected to a hardware input/output?
A Java stream is an abstraction: just something that you can read from or write to. It is usually backed by an external resource such as a file or a socket. For gory details of each stream, and there are dozens, see the source code. The only two streams that really accord with your description 'sequence of memory addresses' are ByteArrayInputStream and ByteArrayOutputStream.
A socket is an endpoint of a communication. Internally it is a data structure in the kernel, and it is 'connected' to a network protocol stack which in turn is connected to one or more network interface cards (NICs).