{"id":18612491,"url":"https://github.com/alejandro945/ice-fibonacci","last_synced_at":"2026-05-18T01:02:31.187Z","repository":{"id":69072118,"uuid":"603168741","full_name":"alejandro945/ice-fibonacci","owner":"alejandro945","description":"Distributed programming to calculate the fibonacci sequence","archived":false,"fork":false,"pushed_at":"2023-05-19T15:16:14.000Z","size":9289,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T00:11:16.146Z","etag":null,"topics":["gradle","ice","java","slice"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alejandro945.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-17T19:03:22.000Z","updated_at":"2023-02-17T21:41:22.000Z","dependencies_parsed_at":"2024-12-27T02:32:18.965Z","dependency_job_id":null,"html_url":"https://github.com/alejandro945/ice-fibonacci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alejandro945/ice-fibonacci","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandro945%2Fice-fibonacci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandro945%2Fice-fibonacci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandro945%2Fice-fibonacci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandro945%2Fice-fibonacci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alejandro945","download_url":"https://codeload.github.com/alejandro945/ice-fibonacci/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandro945%2Fice-fibonacci/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263699785,"owners_count":23497963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","ice","java","slice"],"created_at":"2024-11-07T03:17:37.804Z","updated_at":"2026-05-18T01:02:22.057Z","avatar_url":"https://github.com/alejandro945.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ice Middleware - Fibonacci Calculator 🎁\n\nDistributed programming to calculate the fibonacci sequence. The Fibonacci numbers, commonly denoted Fn , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding.\n\n## Build With 🛠️\n\n\u003cdiv align=\"left\"\u003e\n    \u003cp\u003e\n        \u003ca href=\"https://code.visualstudio.com\" target=\"_blank\"\u003e \u003cimg alt=\"Visual Studio Code\" src=\"https://raw.githubusercontent.com/devicons/devicon/1119b9f84c0290e0f0b38982099a2bd027a48bf1/icons/vscode/vscode-original.svg\" height=\"60\" width = \"60\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://code.visualstudio.com\" target=\"_blank\"\u003e \u003cimg alt=\"Zeroc Ice Middleware\" src=\"https://avatars.githubusercontent.com/u/10439369?s=280\u0026v=4\" height=\"60\" width = \"60\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://gradle.org\" target=\"_blank\"\u003e \u003cimg alt=\"Gradle\" src=\"https://raw.githubusercontent.com/gilbarbara/logos/1f372be75689d73cae89b6de808149b606b879e1/logos/gradle.svg\" height=\"60\" width = \"60\"\u003e\u003c/a\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n## Versioned 📌\n\n\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://git-scm.com/\" target=\"_blank\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/devicons/devicon/2ae2a900d2f041da66e950e4d48052658d850630/icons/git/git-original.svg\" height=\"60\" width = \"60\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/\" target=\"_blank\"\u003e \u003cimg src=\"https://img.icons8.com/fluency-systems-filled/344/ffffff/github.png\" height=\"60\" width = \"60\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n# First part 📦\n## Configuration 💾\n\nWe're going to use a project with two sub-projects to build the Client and Server applications. The requirements for our sub-projects are the same so we'll do all the setup in the subprojects block of the root project, which applies to all sub-projects. Edit the generated build.gradle file to look like the one below:\n\n```gradle\n...\n\"Class-Path\": configurations.runtimeClasspath.resolve().collect { it.toURI() }.join(' ')\n...\n```\n\nIn order for it to be independent of the computer on which it is developed, it should look like this:\n\n```gradle\n...\n\"Class-Path\": 'opt/Ice-3.7.6/lib/ice-3.7.6.jar'...\n```\n\nWe must also edit the generated settings.gradle to define our sub-projects:\n\n```gradle\nrootProject.name = 'ice'\ninclude 'client'\ninclude 'server'\n```\n\nBesides that, we must edit the file config.server located in server/src/main/resources with the host and port where the server will be deployed, the default server values are these:\n\n```properties\nPrinter.Endpoints=tcp -p 9099\nIce.Default.Host=localhost\n```\n\nFinally, we must edit the file config.client located in client/src/main/resources with the values of the server we want to communicate, the default client values are these:\n\n```properties\nPrinter.Proxy=SimplePrinter:tcp -p 9099\nCallback.Client.Endpoints=default -h localhost\nIce.Default.Host=localhost\n```\n\nAs an **observation**, if you want to run our product remotely, you must change the resource file that is inside the jar (zip) and you must modify the host by the ip and port where the logical interface of your computer is located. We will place an example of how we do it using zerotier as a logical interface identifying the server on the xhgrid9 pc.\n\n### Server\n\n- For your local pc\n\n```properties\nIce.Default.Host=10.147.19.125\n```\n\n- For remotes pc\n\n```properties\nIce.Default.Host=192.168.131.49 # hgrid9.icesi.edu.co (DNS resolves ip)\n```\n\n### Client\n\n- In your local pc\n\n```properties\nCallback.Client.Endpoints=default -h 10.147.19.218 # Your ip in zerotier logic interface\nIce.Default.Host=10.147.19.125 # xhgrid9 (DNS resolves ip)\n```\n\n- In remote pc\n\n```properties\nCallback.Client.Endpoints=default -h 192.168.131.51 # Or hotsname specific of the remote client (hgrid11.icesi.edu.co)\nIce.Default.Host=hgrid9\n```\n\n### Notes 📑\n\nSending jar files using scp command:\n\n```bash\nscp server.jar swarch@xhgrid9:.\nscp client.jar swarch@xhgrid10:.\nscp client.jar swarch@xhgrid11:.\n```\n\n## Compiling the client and server ⭐️\n\n```bash\ngradle build\n```\n\n## Running product remotely 💥\n\n```bash\njava -jar server/build/libs/server.jar\njava -jar client/build/libs/client.jar\n```\n\n![run](./assets/run.png)\n\n## Testing our distributed app local 🐙\n\n- To run client and server, we first start the server in a separate window:\n  ![server](./assets/server.png)\n- At this point, we wont see anything because the server simply waits for a client to connect to it. We run the client in a different window:\n  ![client](./assets/client.png)\n\nSome examples of the client and server communication are documentated below:\n\n- Client:\n  ![client](./assets/client_execution.png)\n- Server: \u003c/br\u003e\n  ![server](./assets/server_execution.png)\n\nTo get rid of the server, we interrupt it on the command line for now. And, to get rid of the client you must write **exit**.\n\n# Second part 📦\n\n## Part I: Implement bash or a simple scheme (e.g., writing to a file)\n\n**The implementation of part I will be in the callback-part-I branch, to go to this branch do clcik \u003ca href=\"https://github.com/alejandro945/ice-fibonacci/tree/callback-part-I\"\u003ehear\u003c/a\u003e**\n\n**To see the analysis and the conclusion reached after automating the process go to the following \u003ca href=\"./docs/Analisis del TimeOut - No concurrencia.pdf\"\u003elink\u003ca\u003e**\n\n**Important remark:** In order to run the bash scripts, you must have the bash package installed. **sshpass**. If you are on a Linux operating system, run:\n\n```bash\nsudo apt-get install sshpass\n```\n\nIf the execution environment is Windows, you must execute the .sh through the **Cygwin** terminal with the sshpass package installed or from a **WSL** execution environment with the sshpass package installed.\n\n### Building our project\n\n- To build our project, we must execute the following command:\n\n```bash\ngradle build\n```\n\n- Once the project is built, our project will already have the .Jar files ready to run the clients and the server on remote pc's. The first thing we must do is to execute the script that will send the .Jar files to the corresponding machines. For this, we must execute the following command:\n\n```bash\n./deploy.sh $1\n```\n\nWhere \"$1\" is a string containing the ids of the machines to which the .Jar will be sent (Clients). To send the script to several machines we must separate the ids by commas. For example, if we want to send the script to machines 4,5,6 and 7, we must execute the following command:\n\n```bash\n./deploy.sh 4,5,6,7\n```\n\nThe .Jar from the server will always be sent to machine 2.\n\n- Run the server on machine 2. To do this, we must execute the following series of commands, from connecting remotely to machine 2, to running the server's .Jar:\n\n```bash\nssh swarch@xhgrid2\ncd GabrielSuarez-AlejandroVarela-CallBack\n./deployServer.sh\n```\n\n- To run the clients, the deployServer script must be running so the Server too. Server must be running. Once this is done, we can move on to running the clients. To run the clients, the following command must be executed:\n\n```bash\n./deployClient.sh $1 $2\n```\n\nWhere **$1** must be equal to the value that was passed in the deploy.sh and **$2** must be equal to the numbers with which you want to perform the fibonacci, like the clients, can be more than one number separated by commas, for example, if you want to run the fibonacci of the number 10 you must run the following command taking into account the clients mentioned above:\n\n```bash\n./deployClient 4,5,6,7 10\n```\n\n- With this we will already have automated the execution of our system, to see the results of the server after the execution, you must go to the machine 2 and execute the following command:\n\n```bash\nssh swarch@xhgrid2\ncd GabrielSuarez-AlejandroVarela-CallBack\ncat server.log\n```\n\nNow to see the result of the clients, we will only look at the **client.log** file that will be stored at the same level of the deploy .sh.\n\n\n## Part II: Modify the server\n\n1. Multi-threaded so that it can respond to multiple requests from different clients, concurrently. Is this concurrency virtual or is it real? how can you prove it? Attach a screenshot of the test.\n\nThe server uses real concurrency techniques, such as multithreading, to handle incoming requests. It also uses task planning techniques to allocate resources fairly and equitably to each request. The server will also implement concurrency control techniques, such as **semaphores**, to avoid race conditions and ensure the integrity of shared data.\n\n2. Answer, with this new version, the two points of Part I.\n\nWe can see that the print comes out through the server's standard output, which means that for numbers of the order of 10 ^8 the print takes longer than what the calculation indicates. Due to **main thread blocking** our program main thread is busy printing.\n\nWe test up to 10 * 10^8 and get a result or timeout of 9 seconds in that order of ideas for. reach the ice time out of 60 seconds knowing that the time complexity of this algorithm is exponential, the approximate number is 6.6 * 10 ^8.\n\n![distri](./assets/distributed.png)\n\n![dist](./assets/dist.png)\n\n3. To allow a client to \"register\", with the hostname and what is necessary for them to make a callback.\n\n```java\n if (!this.clients.containsKey(hostname)) {\n    this.clients.put(hostname, client);\n    System.out.println(hostname + \" joined. \\n\"); // Debug Porpouses\n }\n```\n\n4. Regarding the messages, if the received message:\n   a. Starts with \"list clients\", it should return the list of clients (hostnames or their prefix) registered on the server.\n   b. Starts with \"to X:\", it should send the remainder of the message to X, where X is the destination hostname (or its prefix).\n   c. Starts with \"BC\" (broadcast), the message must be returned by the server to ALL clients registered with it.\n\n```java\n if (message.startsWith(\"exit\")) {\n     this.handler.removeClient(host);\n } else if (message.startsWith(\"list clients\")) { // list clients\n     replyHosts(getHosts());  \n } else if (message.startsWith(\"bc\")) { // bc message\n     emitBroadcast(host, message);\n } else if (message.startsWith(\"to\")) { // to host:message\n     String to = message.replace(\"to\", \"\").trim().split(\":\", 2)[0];\n     String msg = message.replace(\"to\", \"\").trim().split(\":\", 2)[1];\n     send(host, to, msg); \n } else { // Fibonacci Calculation\n     this.proxy.callback(validationLayer(this.message));\n } \n```\n\n### Concurrency\n\n- This problem was resolve implementing a CallBack, this CallBack has a real concurrency, to see more information about this.\n\n**To see the analysis and the conclusion reached after automating the process go to the following \u003ca href=\"./docs/Analisis del TimeOut - Concurrencia.pdf\"\u003elink\u003ca\u003e**\n\n## **Authors** ✒️\n\n\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://github.com/alejandro945\" target=\"_blank\"\u003e \u003cimg alt=\"alejandro945\" src=\"https://images.weserv.nl/?url=avatars.githubusercontent.com/u/64285906?v=4\u0026h=60\u0026w=60\u0026fit=cover\u0026mask=circle\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/gabrielSB19\" target=\"_blank\"\u003e \u003cimg alt=\"gabrielSB19\" src=\"https://images.weserv.nl/?url=avatars.githubusercontent.com/u/71047565?v=4\u0026h=60\u0026w=60\u0026fit=cover\u0026mask=circle\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/for-you.svg)](https://forthebadge.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandro945%2Fice-fibonacci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejandro945%2Fice-fibonacci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandro945%2Fice-fibonacci/lists"}