{"id":21001309,"url":"https://github.com/rahul-barick/diary-application","last_synced_at":"2026-04-09T19:53:08.292Z","repository":{"id":231214876,"uuid":"124524142","full_name":"Rahul-Barick/diary-application","owner":"Rahul-Barick","description":"Simple Diary Application using node.js express framework focused on scalibility","archived":false,"fork":false,"pushed_at":"2018-03-10T21:52:05.000Z","size":4804,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T09:46:32.992Z","etag":null,"topics":["ajax","ajax-call","architecture","clustering","database","datatables","expressjs","functional-programming","jade","jquery","middleware","mongodb","node-clean","nodejs","non-relational","pug","pug-template-engine","routing","scalable-applications","session-management"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rahul-Barick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-03-09T10:12:58.000Z","updated_at":"2020-06-03T22:05:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c56b42b-208c-46da-9c67-50ccc9dacf7b","html_url":"https://github.com/Rahul-Barick/diary-application","commit_stats":null,"previous_names":["rahul-barick/diary-application"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Barick%2Fdiary-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Barick%2Fdiary-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Barick%2Fdiary-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Barick%2Fdiary-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rahul-Barick","download_url":"https://codeload.github.com/Rahul-Barick/diary-application/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243418844,"owners_count":20287800,"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":["ajax","ajax-call","architecture","clustering","database","datatables","expressjs","functional-programming","jade","jquery","middleware","mongodb","node-clean","nodejs","non-relational","pug","pug-template-engine","routing","scalable-applications","session-management"],"created_at":"2024-11-19T08:14:38.707Z","updated_at":"2025-12-25T19:47:03.678Z","avatar_url":"https://github.com/Rahul-Barick.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diary-application\nSimple Diary Application using node.js express framework\n\nBuilding a RESTFUL API with NODE, pure Raw MongoDB query on  Diary Application\n\nFor Listing Data I have used ``Jquery DataTables plugin as Server Side Rendering Tables Using Ajax Call``\n\nUsed Server side Template Engine as ``pug``\n\nAdded Searching Functionality using Jquery.\n\nYou can download this repository by using the green ``Clone or Download`` button on the right hand side of this page. This will present you with the option to either clone the repository using Git, or to download it as a zip file.\n\nIf you want to download it using git, copy paste the link that is presented to you, then run the following at your terminal:\n ```\nhttps://github.com/Rahul-Barick/diary-application\ncd diary-application\nnpm install\n```\nAfter Downloading Run the Each Command From ``queries.txt`` on the terminal or Download the \n[RoboMongo](https://robomongo.org/download) and Insert the command\n\n# Start the server\n\n``nodemon diary-app.js``\n\nNow is a good time to seque into some tooling that will make things much easier when developing Node applications. \n``Nodemon`` is a utility that will monitor for any changes in your source and automatically restart your server.\n\n# Login\n\nLogin Route http://localhost:3000/login\n\n# Scalibility of diary application\n\n1. The cluster module can be used to enable load balancing over an environment’s multiple CPU cores. It’s based on the child process module fork method and it basically allows us to ``fork`` the main application process as many times as we have CPU cores. It will then take over and load balance all requests to the main process across all forked processes.\n\n2. The cluster module is Node’s helper for us to implement the cloning scalability strategy, but only on one machine.\n\n3. Cluster module does is simple\n    We create a master process and that master process forks a number of worker processes and manages them. Each worker process represents an instance of the application that we want to scale. All incoming requests are handled by the master process, which is the one that decides which worker process should handle an incoming request.\n\n ![alt text](https://cdn-images-1.medium.com/max/1000/1*C7ICI8d7aAna_zTZvZ64MA.png \"Cluster module\")\n \n4. The master process’s job is easy because it actually just uses a round-robin algorithm to pick a worker process.\n \n5. The round-robin algorithm distributes the load evenly across all available processes on a rotational basis. The first request is forwarded to the first worker process, the second to the next worker process in the list, and so on. When the end of the list is reached, the algorithm starts again from the beginning.\n \n6. One of the simplest and most used load balancing algorithms.\n \n7. One of the simple benchmark of how many requests this server can handle per second. So we are using [Apache Benchmarking tool](https://httpd.apache.org/docs/2.4/programs/ab.html)\n \n8. Run the command on command line ``ab -c200 -t10 http://localhost:3000/`` to each api end point.This command will test-load the server with 200 concurrent connections for 10 seconds.\n \n``Important : First start the node server eg:- node diary-application.js then test-load the server as developer perspective``\n\n# Command Line Interface\n\n```\nrahul@rahul-HP-Pavilion-15-Notebook-PC:~/diary-application$ ab -c200 -t10 http://localhost:3000/notes/list\nThis is ApacheBench, Version 2.3 \u003c$Revision: 1706008 $\u003e\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking localhost (be patient)\nCompleted 5000 requests\nCompleted 10000 requests\nCompleted 15000 requests\nFinished 17409 requests\n\n\nServer Software:        \nServer Hostname:        localhost\nServer Port:            3000\n\nDocument Path:          /notes/list\nDocument Length:        49 bytes\n\nConcurrency Level:      200\nTime taken for tests:   10.000 seconds\nComplete requests:      17409\nFailed requests:        0\nNon-2xx responses:      17414\nTotal transferred:      6802577 bytes\nHTML transferred:       853281 bytes\nRequests per second:    1740.85 [#/sec] (mean)\nTime per request:       114.886 [ms] (mean)\nTime per request:       0.574 [ms] (mean, across all concurrent requests)\nTransfer rate:          664.30 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   1.3      0      17\nProcessing:    17  114  12.3    113     188\nWaiting:        9  111  11.9    110     185\nTotal:         29  114  11.7    113     188\n\nPercentage of the requests served within a certain time (ms)\n  50%    113\n  66%    116\n  75%    119\n  80%    121\n  90%    127\n  95%    133\n  98%    148\n  99%    155\n 100%    188 (longest request)\n\n```\nOn my machine, the single node server was able to handle about ``1740`` requests per second.\nas you can see on the terminal ``Requests per second:    1740.85 [#/sec] (mean)``\n\nThe results here will be different on different platforms and this is a very simplified test of performance that’s not a 100% accurate, but it will clearly show the difference that a cluster would make in a multi-core environment.\n\nNow we have a reference benchmark, we can scale the application with the cloning strategy using the cluster module.\n\n# MIT License\n\nCopyright (c) 2018 Rahul Barick\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-barick%2Fdiary-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahul-barick%2Fdiary-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-barick%2Fdiary-application/lists"}