VPS filesystem performance to slow, is this workaround safe?

More
10 years 1 month ago #49603 by ceap80
I have a moderately big flexicontent installation on medatemple gridserver.

We are having performance problems with filesystem access, specially in the image plugin.

The image plugin check for file existence using php function 'file_exists' and in the gridserver this function performs the worst.

I was thinking to eliminate that 'file_exists' check in
Code:
/ Eliminate records that have no original files $securepath = JPath::clean(COM_FLEXICONTENT_FILEPATH.DS); $existing_files = array(); foreach($filenames as $filename) { $filepath = $securepath . $filename; if (file_exists($filepath)) { $existing_files[] = $filename; } }

and intead run a cronjob to delete from database the records if the image does not exists in the file system, something like:
Code:
DELETE FROM jos_flexicontent_fields_item_relations WHERE field_id = 19 and item_id = <?>;

Where <?> is the id of the item which it image is not found.

So my question is, is this a safe thing to do?
Would I damage my flexicontent installation by doing this?

Thanks for your comments...

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #49604 by ggppdk
Hello

test by replacing
if (file_exists($filepath)) {:
with:
if (1) {


to see if there is an effect on performance ?

i say this because the above for original image,



later we do 4 file_exists and 4 getimagesize
Code:
if (file_exists($path)) { $filesize = getimagesize($path); ...

for the 4 thumbnails of the image fields
small
medium
large
backend


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #49663 by ggppdk
Hello

so it is not only checking if original images, it is also checking if thumbnails exist and are of correct size

so in total you have:

5 file_exists()
and
4 getimagesize()

are you sure it is file_exists() ?
and not getimagesize()


i ask because for getimagesize() we can avoid it by adding a parameter not to check if thumbnails are of correct size,

So are using some profiling tool that gives you timing cost per function ? is the total of file_exists() only from image field or is it from other code too ??

Which PHP profile tool are you using ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.282 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline