Welcome Guest, Not a member yet? Register   Sign In
How does image_lib perform under heavy usage?
#1

[eluser]KeyStroke[/eluser]
Hi,

I've implemented an image upload/resize function on my site yesterday. I had to do some tweaks so I don't get that "memory exhausted" issues when resizing. Now it's running pretty smoothly.

What I'd like to know is, how would file uploads perform when used by say 1000 users at the same time? will it exhaust the server? if so, then what are the alternatives?


Appreciate your help
#2

[eluser]Yash[/eluser]
I guess it's not image lib issue.It all depend on ur server config
#3

[eluser]KeyStroke[/eluser]
So how do I make sure my server handles the image upload pressure?
#4

[eluser]Derek Allard[/eluser]
Yeah, image manipulation is among the most processor intense activities you can do. Simple uploading shouldn't be a big deal, but if each the 1000 concurrent users is also trying to crop or scale an image... it'll bog a server down. This isn't a CI thing, CI just hands it off to the GD2 (or whatever) lib, the fact of the matter is that its just very processor intense.

What you may want to do is implement a system where jobs are que-ed, and the users are email notified when the job is completed.
#5

[eluser]KeyStroke[/eluser]
Thanks Derek!

My application only uploads an image and creates two versions of it: thumbnail size and preview size (a little bit bigger). Do you think this will impact the performance of the server on concurrent uploads?

Also, I have two more questions if you guys don't mind:

1) Which configuration(s) should I modify on my server to handle uploads better? (if any)

2) How do you queue image resizing? and how come many sites (like facebook for example) upload and resize my images immediately? what are they doing differently?


Thanks Smile
#6

[eluser]Derek Allard[/eluser]
Quote:Do you think this will impact the performance of the server on concurrent uploads?
Yes.
Quote:1) Which configuration(s) should I modify on my server to handle uploads better? (if any)
Uploads probably won't be the (main) problem, it'll be image manipulation once they're up there. For that, probably more ram, and I think GD2 performs faster then the other image libs, but I'd look into that.
Quote:2) How do you queue image resizing? and how come many sites (like facebook for example) upload and resize my images immediately? what are they doing differently?
You'll need to build it yourself. Comparing yourself to facebook is a dangerous road to go down, they have resources that you probably don't have access to. That said, if not all 1000 visitors are literally using it at the same time, then I have no reason to believe you couldn't do it on the fly - but you specified that they'd all be using it at the same time.
#7

[eluser]KeyStroke[/eluser]
Thanks Derek.

Well my question about the queue was about its concept, not asking for any code. Smile

Also, is there a way to catch memory errors (when a lot of people are uploading at once) and displaying a message to the user instead of that ugly PHP message? I thought I could at least display a meaningful error (like "try again later") instead of letting the application crash.
#8

[eluser]marcoss[/eluser]
A simple flow for the queue implementation could be:

1. User uploads original image to the server.
2. A DB record is created with image location, user_id and status = pending.
3. Every "x amount of time", you run a process (cron) to execute whatever is on the queue, don't process the whole queue, just the last "x amount of items", older first, of course.
4. Every time you process and item, update the status, and notify the user.

You can also have different "actions" (crop, rotate, thumbnail) on the same queue and run similar task together for better performance.
#9

[eluser]Mellis[/eluser]
[quote author="KeyStroke" date="1217247730"]Hi,

I've implemented an image upload/resize function on my site yesterday. I had to do some tweaks so I don't get that "memory exhausted" issues when resizing. Now it's running pretty smoothly.

What I'd like to know is, how would file uploads perform when used by say 1000 users at the same time? will it exhaust the server? if so, then what are the alternatives?


Appreciate your help[/quote]

Could you explain what tweaks you are talking about?
I'm having a little trouble with the exhausted memory...
#10

[eluser]mglinski[/eluser]
Just FYI, Facebook pre-processes any images you upload to photo galleries(95% of image uploads) using a java applet. You can also implement a system like this and use your users computing power to do your work for you.
-Matt




Theme © iAndrew 2016 - Forum software by © MyBB