Comments (5)
What exactly do you want here? Do you want global variables set in
JavaScript to persist between requests? If so, that's impossible, as PHP is
just not set up that way. But if you just want to more efficiently reload
scripts, there are ways to make that persistent.
On Oct 31, 2013 9:25 AM, "esv" [email protected] wrote:
Hi!
Is it possible to persist V8 instance between requests in web server? I
found old issue on this topic #4https://github.com/preillyme/v8js/issues/4and seems it was impossible back than. Do you have plans to implement it? I
think it would be useful feature, like persistent connections in mysql
extensions.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/78
.
from v8js.
Exactly: creating V8 instance (code "new V8Js();") on my machine takes 20ms, I want it to take <1ms.
But if you just want to more efficiently reload scripts, there are ways to make that persistent.
This can be done via V8Js::registerExtension?
from v8js.
what we want is that the v8 context is persistent accross different php requests, this doesn't refer to specific global variables in javascript but to the whole javascript context.
Currently the js context is bound to the PHP instance of the the running script, when the script completes the js context is released.
For this v8js extension to be fully usable in real scenarios it is necessary to have a way of making the context persistent so that it can be re-used accross multiple requests
from v8js.
You would need to be running Apache in "Pre-fork" or "Worker MPM" mode (or IIS in ISAPI mode) and be using the multiprocess or multithreaded SAPI for PHP. You wouldn't be guaranteed that the context would be reused, but a small number of contexts would typically be used for a largish number of requests. Again, you couldn't share global variables, because contexts aren't guaranteed to be reused. V8 supports this; we just need to hook up some bits in v8js differently.
from v8js.
PHP has a "shared nothing" architecture ... and I don't think V8Js should "solve" this by decoupling PHP lifetime from V8 lifetime, contextwise. This would require to invalidate PHP objects exported to Javascript as soon as the PHP request ends (since they're forcibly destroyed by PHP engine then; and we can't and shouldn't change that), ... and that'd get really messy then.
Closing this now since there's been no discussion for a long time now.
from v8js.
Related Issues (20)
- Trying to compile with php8 branch on ubuntu 22, getting error: could not determine libv8 version (v8 compiled succesfully) HOT 3
- Dynamic Properties deprecation in PHP 8.2 HOT 4
- Broken build on PHP 8.0.x HOT 2
- Segmentation fault - possibly another GC issue? HOT 7
- Compromise between FORCE_ARRAY and standard setup HOT 8
- sandbox error with v8 11.1.277.13 HOT 1
- libv8 must be version 9.0 or greater (using dockerfile) HOT 1
- Issue running make in ubuntu 22.04 HOT 2
- windows php 8.1
- compile error with g++ 13: error: expected unqualified-id before '&' token
- With wich version of V8 this php library work ? HOT 4
- Error installing on debian 11
- This LIB is very hard to install ! HOT 14
- PROHIBITS_OVERWRITING removed from V8 and causing V8Js compile error. HOT 1
- V8Js 3.0.0 HOT 1
- Is the latest recommended release 2.1.1 or 2.1.2? HOT 4
- Do I have permission to refactor this? HOT 3
- Compilation error: "no matching function for call to 'v8::ObjectTemplate::SetAccessor" HOT 6
- Linux arm64 support? HOT 3
- Is there an official installation tutorial for the v8js extension? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v8js.