Share Objects(resources) between multiple php threads
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
True, but it also sounds like something as simple as an SQLite database on a RAM disk would do the job as well. The Share Nothing style is to use standard tools and standard methodologies to solve problems. It also implies that the solution to a performance problem is rearchitecting ... not building a bigger, rocket powered hammer.feyd wrote:memcache and shmop may be of interest.
(#10850)
I did some tests and I realized that even if I could communicate between threads, php is slow. Really slow, its great for web apps but not for servers
. For example, in the game there are literally hundreds of game objects that need to be updated once a second. Php takes over 27 seconds to do a simple loop through an array of objects and call the update() method on each one. The processing involved in updating the entities calls for nothing more than a few simple conditionals (pulled from local vars, no db stuff or anything) and sometimes simple math (no floating points).
I'm almost done porting the server into java and use memcached for communication betwen the php client & js server.
I'm almost done porting the server into java and use memcached for communication betwen the php client & js server.