I'm still trying to understand what this does and what's the use case. Is the "edge" a server? The browser? Why should I compile WordPress or Laravel to wasm?
In this context the edge is a fancy word to say "serverless". It just means that your PHP interpreter will be started on-demand on a node closer to your customer's request. So if your website receives no requests, it costs you nothing. And requests have less latency for the user. That's the theory anyway, in my experience reality is a lot more nuanced because the serverless node still has to reach a database and so o…
Running PHP fast at the edge with WebAssembly
11–20 of 98 posts
Re: Running PHP fast at the edge with WebAssembly
#12Whereby fast is "About half the speed of native PHP"
Author here. Faster than it has ever been in the Edge via WebAssembly :) But you are completely right pointing out that there's still some room to improve, specially when compared to running PHP natively. Right now there's some price to pay for the isolation and sandboxing, but we are working hard to reduce the gap to zero. Stay tuned for more updates on this front!
Re: Running PHP fast at the edge with WebAssembly
#13I'm still trying to understand what this does and what's the use case. Is the "edge" a server? The browser? Why should I compile WordPress or Laravel to wasm?
The “edge” in this case is the browser (from a pure WASM standpoint, though I see these guys also offer a hosted serverless version too). For most general-purpose applications, there’s no point to WASM. But some apps may run specific functions which take a long time (e.g. bulk/batch processing), and being able to execute those tasks securely on the client side provides immediate feedback and better UX. That’s just on…
Re: Running PHP fast at the edge with WebAssembly
#14Re: Running PHP fast at the edge with WebAssembly
#15I'm still trying to understand what this does and what's the use case. Is the "edge" a server? The browser? Why should I compile WordPress or Laravel to wasm?
The “edge” in this case is the browser (from a pure WASM standpoint, though I see these guys also offer a hosted serverless version too). For most general-purpose applications, there’s no point to WASM. But some apps may run specific functions which take a long time (e.g. bulk/batch processing), and being able to execute those tasks securely on the client side provides immediate feedback and better UX. That’s just on…
Re: Running PHP fast at the edge with WebAssembly
#16 - The user sends an HTTP request to somesite.com
- Their DNS query for somesite.com gets resolved to some datacenter near them
- The HTTP request arrives at the datacenter where the PHP in WebAssembly is executed at half the speed of native PHP
- The PHP in Webassembly sends database queries to a central DB server over the internet
- The PHP in Webassembly templates the data and sends it back to the user
How is that faster than resolving somesite.com to the central server, sending the HTTP query to the central server where PHP runs at full speed and talks to the DB on the same machine (or over the LAN)? Even if PHP ran at full speed at the "Edge", won't the two requests over the internet user --1--> edge PHP server --2--> central Db server
take longer than the one http request when the user connects to the central server directly? user --1--> central PHP+DB server
In reality, the PHP script on the "Edge" server probably makes not one but multiple queries to the DB server. Won't that make it super slow compared to having it all happening on one machine or one LAN?Re: Running PHP fast at the edge with WebAssembly
#17Earlier quoted context omitted.
Author here. Faster than it has ever been in the Edge via WebAssembly :) But you are completely right pointing out that there's still some room to improve, specially when compared to running PHP natively. Right now there's some price to pay for the isolation and sandboxing, but we are working hard to reduce the gap to zero. Stay tuned for more updates on this front!
Is this tech meant for developers' needs only, or can regular, already existing PHP websites (e-shops...) somehow take advantage of it as well?
You can deploy apps on the Wasmer Edge cloud, and also host things yourself if you want to, though in the later case the setup will be non-trivial.
Re: Running PHP fast at the edge with WebAssembly
#18I'm still trying to understand what this does and what's the use case. Is the "edge" a server? The browser? Why should I compile WordPress or Laravel to wasm?
In this context the edge is a fancy word to say "serverless". It just means that your PHP interpreter will be started on-demand on a node closer to your customer's request. So if your website receives no requests, it costs you nothing. And requests have less latency for the user. That's the theory anyway, in my experience reality is a lot more nuanced because the serverless node still has to reach a database and so o…
Re: Running PHP fast at the edge with WebAssembly
#19I'm still trying to understand what this does and what's the use case. Is the "edge" a server? The browser? Why should I compile WordPress or Laravel to wasm?
The “edge” in this case is the browser (from a pure WASM standpoint, though I see these guys also offer a hosted serverless version too). For most general-purpose applications, there’s no point to WASM. But some apps may run specific functions which take a long time (e.g. bulk/batch processing), and being able to execute those tasks securely on the client side provides immediate feedback and better UX. That’s just on…
Re: Running PHP fast at the edge with WebAssembly
#20Let me try to understand this "Edge" thing: - The user sends an HTTP request to somesite.com - Their DNS query for somesite.com gets resolved to some datacenter near them - The HTTP request arrives at the datacenter where the PHP in WebAssembly is executed at half the speed of native PHP - The PHP in Webassembly sends database queries to a central DB server over the internet - The PHP in Webassembly templates the dat…