lagom-samples | open source framework for building reactive microservice
kandi X-RAY | lagom-samples Summary
kandi X-RAY | lagom-samples Summary
Lagom is an open source framework for building reactive microservice systems in Java or Scala. This repository contains code examples to help you understand how to achieve common goals. In general, code in each folder of this repository tries to answer a question of type "How do I xyz ?". For example: "How do I use RDBMS read-sides with Cassandra write-sides?".
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Adds the checkout event
- Sets the checkout date
- Find the report with the given ID
- Create a new shopping cart report
- Sets the creation date
- Sets the id
- Returns a shopping cart report
- Check a shopping cart
- Get the entity reference
- Find an existing shopping cart
- Send Hello request
- On checkout out
- Handles a remove item
- The shopping cart topic
- Modify itemQuantity
- Returns the shopping cart view
- On add item
- Add a quantity to an inventory
- Start a Hello command
- Registers an event handler for the HelloStateChanged event
- Lists user greetings
- Gets the command handler
- Use this method to use a greeting message
- OnAdjustItemQuantity adjustment
lagom-samples Key Features
lagom-samples Examples and Code Snippets
Community Discussions
Trending Discussions on lagom-samples
QUESTION
We observe that on increasing concurrent http calls to our service, thread count (akka.actor.default-dispatcher) keeps increasing (see screenshot from visualVM). Also after the requests stop, the thread count don’t go down. And most of these remain in PARK state. Is this proportional increase of threads an expected behaviour? How do we control this and reuse the same actors or kill the actors after request has been served.
I’m running the shopping-cart example from lagom-samples.
...ANSWER
Answered 2021-Apr-12 at 06:51Are you blocking in your calls? Eg, are you calling Thread.sleep? Or using some synchronous IO? If so, then what you're seeing is entirely expected.
Lagom is an asynchronous framework. All the IO and inter-service communication mechanisms it provides are non blocking. Its thread pools a tuned for non blocking. If you only using non blocking calls, you will see the thread pools behave with very low thread counts, and you won't find things going unresponsive.
But the moment you start blocking, all bets are off. Blocking requires one thread per request.
The default dispatcher that Akka uses is a fork join pool. It is designed for asynchronous use. If you block in a thread in its pool, it will start another thread to ensure other tasks can continue. So, that's why you see the thread pool grow. Don't block, and this won't happen.
The thread pool executor on the other hand uses a fixed number of threads. If you block on this, then you risk deadlocking the entire application. Don't block, and this won't happen.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install lagom-samples
You can use lagom-samples like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the lagom-samples component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page