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

Support deployment of complex tools such as Meilisearch #586

Open
brillout opened this issue Feb 15, 2023 · 7 comments
Open

Support deployment of complex tools such as Meilisearch #586

brillout opened this issue Feb 15, 2023 · 7 comments
Labels

Comments

@brillout
Copy link

brillout commented Feb 15, 2023

Is deploying something like Meilisearch considered out of scope?

Edge deployments such as Cloudflare Workers are limited to wasm(/JavaScript), but I can see that supporting other environments to be important until wasm becomes ubiquitous.

Also, I'm curious: how do you see Lagon in relation to database deployment? Is it considered out-of-scope, even in the long term, and instead the recommendation is to use a dedicated database deployment platform such as PlanetScale?

@QuiiBz
Copy link
Member

QuiiBz commented Feb 15, 2023

Looking at how Meilisearch can be installed, it's only a binary and can't compile to/run in WebAssembly. Lagon and other similar platforms are designed for small to medium workloads, with low resource usage in order to support more tenants on the same hardware and as such, lower the end cost for clients. Applications like Meilisearch that require file system access, networking, etc should instead be deployed on CaaS platforms (like fly.io, ECS, ...) or more commonly on some kind of cloud/baremetal servers.

Lagon will have database(s) product(s) in the future, located in the same regions as where functions are running. That's a very important topic, as it will lower the read/write latency (and as such the total latency of requests) compared to existing solutions like PlanetScale that are available in fewer regions.

@brillout
Copy link
Author

I see, makes sense.

Applications like Meilisearch that require file system access, networking, etc

Wouldn't WASI provide a sandboxed solution for this?

small to medium workloads

I would expect Meilisearch's server runtime to be relatively small compared to its async processing code.

Correct me if I'm wrong, but the only inherent problem I see with deploying large pieces of Wasm code to the edge are slow cold starts. But this isn't a problem for async jobs so, in principle, I'm thinking Lagon could support heavy async jobs.

Or is it about performance? That larger piece of codes would significantly benefit performance improvements from being run without Wasm/sandbox.

I'm trying to picture a future where Lagon covers all / the most prominent web/mobile app use cases. Telling users to use a CaaS in addition to Lagon isn't ideal.

FYI Meilisearch is actually showing interest in targeting WebAssembly: meilisearch/meilisearch#455.

Lagon will have database(s) product(s) in the future

Neat. Could it support any database such as PostgreSQL?

That's a very important topic, as it will lower the read/write latency (and as such the total latency of requests) compared to existing solutions like PlanetScale that are available in fewer regions.

Yes and, together with RPC, that's a neat DX with great performance.

@QuiiBz
Copy link
Member

QuiiBz commented Feb 15, 2023

Wouldn't WASI provide a sandboxed solution for this?

I'm not very familiar with WASI, but that might be a valid solution.

the only inherent problem I see with deploying large pieces of Wasm code to the edge are slow cold starts

That's partially true. I haven't personally compared WASM vs JS cold starts, but I've often read that the former is a lot faster to boot. As an example, Fastly Compute@Edge doesn't keep "warm" functions - each request triggers a completely new instance, but it's so fast that it doesn't feel like "cold starts".

Using WASM often means having higher resource requirements, whereas resources are limited in edge environments (to support more clients & more regions for lower latency & lower cost). The nice thing about using V8 is that we can have JS and WASM functions under the same engine. Regarding runtime performances, I guess it really depends on what the code does: accessing and performing DOM operations is currently faster in JS, but more general code is faster in WASM.

Telling users to use a CaaS in addition to Lagon isn't ideal

Agree, but edge computing doesn't solve all problems. Depending on what you need and what you want to achieve, you might still need to run some kind of workload separate vps/baremetal server. That's also why Lagon will have an ecosystem of products around it, similar to what Cloudflare does.

If Meilisearch lands a WebAssembly target, we definitely should try to support it.

Could it support any database such as PostgreSQL?

SQL yes, but I can't tell you yet if it will be PostgreSQL, SQLite, or something else (because I don't know yet 😅). I'll have to benchmark different solutions and ask users what they need the most!

@brillout
Copy link
Author

Agree, but edge computing doesn't solve all problems

That's precisely what I'm trying to gauge 👀.

SQL yes, but I can't tell you yet if it will be PostgreSQL, SQLite, or something else (because I don't know yet 😅). I'll have to benchmark different solutions and ask users what they need the most!

With WASI, how about any database? If WASI is performant enough.

@QuiiBz
Copy link
Member

QuiiBz commented Feb 16, 2023

With WASI, how about any database? If WASI is performant enough.

There's a distinction here: I was talking about hosting databases on each region, but not inside Lagon's runtime (because it's not designed for long-lived workloads). Hosting a DB on WASI means we need a storage solution like Cloudflare KV/R2. I'll need to check more in-depth how WASI works and how performant it is.

@vmarchaud
Copy link

@brillout I'm interested into understanding what's your requirement for having to host meilisearch (or any database) to the edge ? Is that a latency requirement ? Maybe easier deployment ? Less cost ?

@brillout
Copy link
Author

Mostly DX. Being able to run a single commend $ pnpm execute lagon deploy to deploy everything. I know it's asking a lot, hence my original question which deployment parts are considered to be within the scope of the Lagon project.

Actually, I'd argue that not everything needs to be "edgy" (i.e. run by V8). As a user, all I care about is deploying my app and it's Lagon's / the deployement platform's job to handle everything for me, ideally in a performant way.

If a platform can pull that off, I've not much doubt that users will come en masse.

I'd love Lagon to be that platform but, obviously, it's no easy task.

Also, as the author of vite-plugin-ssr (and upcoming higher-level frameworks built on top of vite-plugin-ssr), I'm interested in what deployment platforms I can integrate with and suggest to my users.

@brillout brillout mentioned this issue Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants