TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Running PHP fast at the edge with WebAssembly

116 点作者 ecmm12 个月前

12 条评论

TekMol12 个月前
Let me try to understand this &quot;Edge&quot; thing:<p><pre><code> - 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 </code></pre> 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 &quot;Edge&quot;, won&#x27;t the two requests over the internet<p><pre><code> user --1--&gt; edge PHP server --2--&gt; central Db server </code></pre> take longer than the one http request when the user connects to the central server directly?<p><pre><code> user --1--&gt; central PHP+DB server </code></pre> In reality, the PHP script on the &quot;Edge&quot; server probably makes not one but multiple queries to the DB server. Won&#x27;t that make it super slow compared to having it all happening on one machine or one LAN?
评论 #40458468 未加载
评论 #40458501 未加载
评论 #40459523 未加载
评论 #40462489 未加载
评论 #40458597 未加载
评论 #40459994 未加载
评论 #40461982 未加载
评论 #40463728 未加载
评论 #40458464 未加载
评论 #40458777 未加载
评论 #40461340 未加载
maxloh12 个月前
Given that we run PHP on the edge, what is the point of running the PHP interpreter on top of a WebAssembly interpreter (Wasmer) instead of just running the PHP interpreter directly?<p>The latter will always be faster.
评论 #40461115 未加载
评论 #40459172 未加载
irq-112 个月前
<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38829557#38834787">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38829557#38834787</a><p>&gt;&gt; Ask HN: What are your predictions for 2024?<p>&gt; Server-side WASM takes off with the re-implementation of PHP, Ruby&#x2F;Rails, Python, and others, and a WASM based virtual server (shell, filesystem, web server, etc..) Cost more but has better security for both the host and user.<p>Guess I was wrong about it costing more?<p>&gt; … we can run PHP safely without the overhead of OS or hardware virtualization.<p>But it only runs at half the speed of PHP, so you need more resources.
choutianxius12 个月前
I think this will face the same problems as Next.js edge runtime: your database cannot be moved to the edge
评论 #40468675 未加载
ahofmann12 个月前
I&#x27;m still trying to understand what this does and what&#x27;s the use case. Is the &quot;edge&quot; a server? The browser? Why should I compile WordPress or Laravel to wasm?
评论 #40458132 未加载
评论 #40458140 未加载
moomoo1112 个月前
Can someone ELI5 what is does &quot;edge&quot; computing means?<p>The way I understand it is that is moving some operations closer to the client to avoid bandwidth costs and improve performance.<p>I thought of the Tesla car computer as edge computing, as it does a lot of processing within the car that would otherwise add latency and reliance on a internet connection.<p>But for web browsers? Going to some websites?<p>What sort of apps need this functionality?<p>Seems like over-engineering, so I&#x27;m looking for someone to explain me.
评论 #40458794 未加载
vander_elst12 个月前
Trying to understand better the solution. Why isn&#x27;t it possible to restrict the application via process isolation (nsjail, cgroups, docker...) and wasm is needed instead?
tambourine_man12 个月前
This looks interesting, but as a feedback, I found the copy a bit repetitive and lacking substance.
flemhans12 个月前
Can i do it on my own hardware?
mike_d12 个月前
Please stop calling it &quot;at the edge.&quot; You have seven locations all in highly developed Equinix datacenters.<p>Edge means getting embedded into ISP networks, cell towers, smaller metros, etc.
评论 #40465762 未加载
评论 #40459162 未加载
Twirrim12 个月前
Whereby fast is &quot;About half the speed of native PHP&quot;
评论 #40457947 未加载
评论 #40458144 未加载
评论 #40459165 未加载
评论 #40458223 未加载
csomar12 个月前
This is trying to solve a solved problem with lots of difficult technology that doesn&#x27;t apply here. Most of the PHP websites are WordPress. The solution to have a speedy WordPress site is to compile it to static HTML. Calls to the server should happen with JavaScript. The server will always remain relevant as WordPress uses a Database and thus the &quot;Edge&quot; makes no sense here.
评论 #40458081 未加载