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

Micro is not very "lightweight" #234

Closed
styfle opened this issue Apr 15, 2017 · 14 comments
Closed

Micro is not very "lightweight" #234

styfle opened this issue Apr 15, 2017 · 14 comments

Comments

@styfle
Copy link
Member

styfle commented Apr 15, 2017

In the readme it says "micro" and "lightweight", but doesn't say what the installed size is. So I went ahead and did my own tests.

mkdir micro-example
cd micro-example
npm init -y
npm install --save micro
du -sh node_modules

This shows 9.2M for micro@7.3.2 and all it's dependencies.

Now lets try with the popular express framework.

mkdir express-example
cd express-example
npm init -y
npm install --save express
du -sh node_modules

This shows 1.8M for express@4.15.2 and all it's dependencies.

I also repeated the same steps for koa@2.2.0 (2M) and hapi@16.1.1 (1.3M) which are also popular web frameworks.

That means micro is the largest of the frameworks one might use to make microservices.

Is this expected?

@leo
Copy link
Contributor

leo commented Apr 15, 2017

micro is not just a framework, but also comes with a development CLI (express and koa don't, I don't know hapi). But yes, we're already working on splitting it out!

@leo leo closed this as completed Apr 15, 2017
@styfle
Copy link
Member Author

styfle commented Apr 15, 2017

we're already working on splitting it out!

Splitting what out?

@leo
Copy link
Contributor

leo commented Apr 15, 2017

The development CLI... 😄

@albinekb
Copy link
Contributor

The code running is a lot less than express / koa, who cares about installed space in 2017?

@leo
Copy link
Contributor

leo commented Apr 18, 2017

@albinekb Yea, that's my opinion. But sadly, a bigger package also means longer installation times in production (which makes deployments slow).

@styfle
Copy link
Member Author

styfle commented Apr 18, 2017

@albinekb My assumption is that micro was designed for implementing microservices.

If you add micro as a dependency to a 1000MB mono-repo, then it's only a 1% increase.

If you add micro as a dependency to 500 individual microservices, that's a 5000MB (5GB) increase in size.

@austinfrey
Copy link

I'm getting 17mb now. @leo what's the status of splitting out the cli?

@timneutkens
Copy link
Member

@aafrey #260

@austinfrey
Copy link

@timneutkens thanks! what are you using to measure package size? the printout looks really nice!

@timneutkens
Copy link
Member

@aafrey this one https://github.com/siddharthkp/cost-of-modules

@austinfrey
Copy link

thanks!

@leo
Copy link
Contributor

leo commented Jul 9, 2017

Very close!

@tim-phillips
Copy link

The split happened:

https://zeit.co/blog/micro-8

@styfle
Copy link
Member Author

styfle commented Oct 19, 2017

I just checked v9.0.0 and it reports 747K.
That's significantly smaller now and appears to be the smallest of the 4 (express, koa, hapi, micro).

Great job! 🎉


Update 2018: You can visualize the install size difference between micro@7.3.3 and micro@8.0.0 with my new tool, Package Phobia, which is much easier than installing yourself 😄

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

No branches or pull requests

6 participants