Jump to content

Shared Memory and SHMOP


Guest

Recommended Posts

Hi,

 

I'm getting into optimization, and I'm exploring migrating all I/O operations from flat files to shared memory.

 

But I'm new at using PHP for this. I checked out the documentation, googled it, found lots of good info, but more help would be appreciated:

 

  1) are PHP's shmop_* functions binary safe?

  2) Can I store a resource in shared memory? Particularly image resources? (I know, I know, just output the binary and put it in shared mem, hence question #1)

  3) Shared memory is persistant, and logically, it is persistent across all users on this server. Correct? Yes, stupid question, but I don't want to find out the hard way that PHP has some kind of psuedo shared memory layer that isn't true shared memory or... er... yea... Making no sense? Yea, no excuse. For some reason, I want to be assured that I'm sane :P

 

ANOTHER THING:

 

Among other things, one thing I'm trying to do is speed up this monster image resizing script (does other things too). It easily goes through 10,000+ images that vary between 100x100 to 8000x8000 (and there's a risk that may grow, yikes).

 

Now obviously, this means aggressive garbage collection after each image, but is there any way to chop a resource into pieces, and combine the result after? Or aggressive garbage collection during image operations?

 

Obviously, I can't open the image resource without eating up hell's worth of ram, so maybe this isn't something I can do in PHP (C, if I must).

 

I have thought of reading the file with fopen and fread and writing it into 3 seperate jpgs and resizing them individually, but doubt it'd work for obvious reasons.

 

Any suggestions?

 

Obviously I've been using obvious too much! But, alright! That's all on my sleep-deprived mind! hehe, all input is appreciated!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.