Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: node app using stdlib #287

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

vorandrew
Copy link
Contributor

Let's compare apples to apples. NodeJS stdlib implementation vs Golang stdlib

@antonputra
Copy link
Owner

@vorandrew sure, will do! just to clarify, it won't matter how many CPU cores i give to node, right? for example, if i give it 4 CPUs, it will still use 1 because it's single-threaded? so again, it wouldn't be fair to compare, i guess. would it make more sense to create 2 replicas of each app and give each 1 CPU instead so we still get 2 CPU per application?

@agravelot
Copy link

agravelot commented Sep 25, 2024

Node can use multiple cores for specific workloads (not about clustered stuffs).

https://www.youtube.com/watch?v=zphcsoSJMvM

@antonputra antonputra mentioned this pull request Sep 25, 2024
@antonputra
Copy link
Owner

@agravelot yes i saw it in documentation

@vorandrew
Copy link
Contributor Author

vorandrew commented Sep 25, 2024

Network I/O operations on node.js runs on the main thread.

Yes, node.js spawns four threads in addition to the main thread but none of them are used for network I/O such as database operations

@vorandrew
Copy link
Contributor Author

vorandrew commented Sep 25, 2024

@vorandrew sure, will do! just to clarify, it won't matter how many CPU cores i give to node, right? for example, if i give it 4 CPUs, it will still use 1 because it's single-threaded? so again, it wouldn't be fair to compare, i guess. would it make more sense to create 2 replicas of each app and give each 1 CPU instead so we still get 2 CPU per application?

It's not CPU cores you are giving... it's CPU limits. Go concurrency is limited by number of physical cores on machine or GOMAXPROCS

Here is good read https://www.ardanlabs.com/blog/2024/02/kubernetes-cpu-limits-go.html

PS: We are having this conversation in the wrong pull request thread

#288

Copy link
Owner

@antonputra antonputra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vorandrew Thanks! I meant limit.

@antonputra antonputra merged commit 6668233 into antonputra:main Sep 25, 2024
@@ -11,7 +11,6 @@
"license": "ISC",
"description": "",
"dependencies": {
"express": "^5.0.0",
"js-yaml": "^4.1.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants