LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2012, 08:35 AM   #1
neoanomally
LQ Newbie
 
Registered: Nov 2010
Posts: 13

Rep: Reputation: 0
Perl Script performance


Let me preface by saying that I am trying to increase performance of this service also I am a newbie in this area. The service is a way for users to transfer files across an internal network that has about 22,000 users. Originally when this service was made only about 2000 unique users used this service.

I am reworking some custom scripts. I have been monitoring some of the top services with the "top" command, and I identified a perl script that goes through a folder and opens every file with a special extension file. It reads the first line of every file that it opens which contains metainformation. Instead of using a database or xml file or a one stop location for metadata on file, the original creator of the program saves one file that contains information about a second file

So the script that continually comes to the top goes through each metafile opens that file. There are roughly 20k files that go through at any given time. This system is kinda like a mailbox system for larger files since email has a limit of 10MB. Also, we have hundreds - thousands of users that use this system every hour... My question how big of an impact could this script have on overall server performance? Is changing this script worth an performance increase? What way should I go about changing this model to increase the performance?
 
Old 09-12-2012, 09:52 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,680

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by neoanomally View Post
Let me preface by saying that I am trying to increase performance of this service also I am a newbie in this area. The service is a way for users to transfer files across an internal network that has about 22,000 users. Originally when this service was made only about 2000 unique users used this service.

I am reworking some custom scripts. I have been monitoring some of the top services with the "top" command, and I identified a perl script that goes through a folder and opens every file with a special extension file. It reads the first line of every file that it opens which contains metainformation. Instead of using a database or xml file or a one stop location for metadata on file, the original creator of the program saves one file that contains information about a second file

So the script that continually comes to the top goes through each metafile opens that file. There are roughly 20k files that go through at any given time. This system is kinda like a mailbox system for larger files since email has a limit of 10MB. Also, we have hundreds - thousands of users that use this system every hour... My question how big of an impact could this script have on overall server performance? Is changing this script worth an performance increase? What way should I go about changing this model to increase the performance?
Not really any good answer for this...we don't know your environment, or what you're seeing. If that script is taking your CPU to 100% for minutes at a time, then yes...it's time for a rewrite. If it bumps slightly for a few seconds, that's a judgment call on your part.

The better question would be "is that perl script causing you any problems in its current configuration?". If it isn't, then that's something you can rework later. If it IS, then yes, it would be a good idea to rework it, but again, we don't know what resources you have available to you.

In my mind, I would personally keep the metadata in a MySQL database, and reference it, but we don't know the context in which the application operates, so it's really hard to give a solid answer.
 
1 members found this post helpful.
Old 09-12-2012, 10:42 AM   #3
neoanomally
LQ Newbie
 
Registered: Nov 2010
Posts: 13

Original Poster
Rep: Reputation: 0
Sorry, again I'm new to this. Umm we are running RHEL 4... I have no control over any configuration files nor can I access other parts of the server. We have a team that puts multiple applications on shared servers. I can work with any of the code within our directory. This script runs every time a user goes to download or upload a file. The trend seems to be that the more users using the application(during peak times) and the number of files on the server ( usually Wednesday - Friday ) because files are stored until all users retrieve the file or 5 day has passed, makes the application run very slow. I was told to use the top command and monitor throughout the day which processes reoccur during slow times.... And that's what script popped up. It's a very small script, but it reads anywhere between 5k-15k files to read the first line only (to retrieve the metadata on each file that is uploaded) so that it knows which files to show the person when they log on to the application.
 
Old 09-12-2012, 10:44 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
probably it can keep the data in the memory and read metadata only when changed (new file arrived)
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
increase perl web script performance? vbsaltydog Linux - Server 3 10-19-2008 08:44 PM
perl script - need help to improve performance johngreg Programming 7 10-14-2008 07:00 PM
need help performance optimizing this perl script hedpe Programming 10 09-07-2006 06:06 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 05:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration