The idea of this project is to design and construct a worker pool to manage several workers in order to concurrently compute Fibonacci numbers via recursion. Moreover, a very basic cache will be implemented, in order to store only final results. It is done in this way because implementing a much better cache practically destroys the need of working with several workers; it becomes too fast. There are a lot of improvements to be done, detailed later on.
An HTTPServer is implemented as a first layer. The User sends a GET Request specifying for which
Note: The current design of the program does not work in a FIFO way, it depends on the execution time. I propose this point as a possible improvent into the code.
When a Worker finish, it caches the result of the
Below, I present a sequence diagram of all the Architecture:
sequenceDiagram
participant User
participant HTTPServer
participant WorkerPool
participant Worker
participant Cache
User ->> HTTPServer: GET localhost:8080/a
HTTPServer ->> WorkerPool: newJob(a)
User ->> HTTPServer: GET localhost:8080/b
HTTPServer ->> WorkerPool: newJob(b)
par
WorkerPool ->> Worker: startNewWorker(a)
Worker ->> Cache: cache the result of Fib(a)
Worker -->> WorkerPool: quitChan <- a
WorkerPool -->> User: output the result of Fib(a)
and
WorkerPool ->> Worker: startNewWorker(b)
Worker ->> Cache: cache the result of Fib(b)
Worker -->> WorkerPool: quitChan <- b
WorkerPool -->> User: output the result of Fib(b)
end
- Read about how to depict formally correct Sequence diagrams and UML diagrams.
- Try to improve the Architecture.
- Solve the problems presented before.