English 中文(简体)
Large File Upload Memory Issue PHP
原标题:

I recently took over a file hosting site (similar to rapidshare, megaupload etc.) and currently averaging about 75k visitors/day. After the migration, we wrote our own system from scratch. It s now time to upgrade the infrastructure and have been toying around with web servers and scaling. Now the issue is that after file upload is complete, the web server is not "flushing" the used-up memory. We uploaded multiple 300MB+ files and before the upload, we had about 3.7G of memory free and after uploading 3 files of 300M each, the memory usage stands at around 1.2G. Initially, we thought it could be apache issue, but upgrading to Litespeed didn t fix it either. Here s the "memory usage" from top

Mem: 4015996k total, 1206036k used, 2809960k free, 114984k buffers

I am scratching my head to figure out how to "flush" the memory used up by the web server or by php during the upload, because this way the system will run out of memory and crash in no time.

Here are my php.ini values:

max_execution_time = 6000 max_input_time = 6000 memory_limit = 2048M post_max_size = 2047M upload_max_filesize = 2047M

On Apache, php runs on fcgi and on Litespeed, it s Litespeed SAPI.

Thanks, Bill

问题回答

I just figured out that it is the "cache memory" and I am able to free it up by this command: echo 3 > /proc/sys/vm/drop_caches

cat /proc/meminfo

MemTotal: 4015996 kB MemFree: 2490780 kB Buffers: 118232 kB Cached: 1204168 kB SwapCached: 0 kB Active: 358748 kB Inactive: 991220 kB Active(anon): 28024 kB Inactive(anon): 0 kB Active(file): 330724 kB Inactive(file): 991220 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 3179664 kB HighFree: 1918528 kB LowTotal: 836332 kB LowFree: 572252 kB SwapTotal: 48827384 kB SwapFree: 48827384 kB





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签