4 ms·
Okay, that Python example is pretty cool - plain virtualenv + pip install, that's a long way from where Lambda is. SAM comes close, but this looks nicer and les
by mcintyre1994 6y ago
Okay, that Python example is pretty cool - plain virtualenv + pip install, that's a long way from where Lambda is. SAM comes close, but this looks nicer and less painful to work with. Although, probably kinda misleading since I imagine most of Python is out of reach because of the transpilation. Does `pip install <any popular dependency>` actually work?
> The main requirement for compiling to JavaScript on Workers is the ability to produce a single js file that fits in our bundle size limit of 1MB.
Compared to Lambda, that's a pretty restrictive size limit. Theirs is 50Mb, or 250Mb if you upload the package to S3. Is there any plan to change that to be closer to Lambda or will anything with larger dependencies always be out of scope?
- AlotOfReading 6y agoI come from an embedded perspective, but 50MB+ to me says either "assets are bundled in" or "more complexity than a full operating system + userspace". I can think of a few products that might hit the latter, but not many. Can you help me understand if there's some massive hidden complexity here that I'm simply unaware of or if this a pretty rare limit to approach?
- ilaksh 6y agoThings like scikit-learn can add up fast.
- mcintyre1994 6y agoIt's really about dependencies. An example would be something like data analysis in Python - you want to read some data, do some fairly complex numeric computation on it, write the result out somewhere else. Under some circumstances the Lambda trade-offs might be pretty good here - you might get cold starts of a few seconds but that's still faster than spinning up a new server to run your one time job, and you're not paying to keep servers up all the time. Some of the libraries you might want to use for that numeric analysis - things like Numpy, Pandas, are pretty large. There's not really a culture of small libraries in Python like a lot of JS libraries, probably because the tradeoffs make less sense the way Python things are traditionally deployed. And there's no concept of tree shaking where dependencies get shrunk to only what you're using either - although maybe you could theoretically make that work on the JS side after transpiling the Python. But basically, if you have really any common data analysis library from Python you're going to be in that 1-50Mb range, and if you have quite a few you can easily be over 50Mb. That is a workload that sometimes works well as a Lambda, and I'm curious if it's one Cloudflare are thinking about for Workers too.
- AlotOfReading 6y agoI hadn't considered the transpiling case. That seems like a pretty reasonable and common scenario, thanks.
- ilaksh 6y agoYeah to me it doesn't say that it can bundle dependencies at all the way I read that.