4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 URGENT: Text Database in Perl
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Wed Dec 31, 2003 4:24 pm (20 years, 3 months ago) Reply with QuoteBack to Top

Dear friends,

I have a script that reads a text database of over 300 MB; I've used the normal procedure to load the database:

open (list, "<$listdata") or &error("Unable to open the data file for reading");
flock list, 2;
@list=<list>;
close(list);
foreach $list(@list) {
etc


The problem is that several users ( about 10 ) tried to use the application at the same time and the server where my site is hosted went out of memory - they had to shutdown the system and reboot ( very impressive, no? Rolling Eyes )

Now, there must be a way for me to read one line from the file at the time ( so the memory loads one line at the time also ) - but honestly I don't know how.

Does anyone knows how I can do this?

This is very urgent.

Best regards,

Kepler
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed Dec 31, 2003 4:35 pm (20 years, 3 months ago) Reply with QuoteBack to Top

Sorry, can't help you, but I don't think the fact that the server can't open multiple instances of a 300mb file reflects badly on the hosting company. In fact I'm surprised they haven't kicked you off the server Laughing

Anyway, good luck with your problem Smile.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Wed Dec 31, 2003 5:54 pm (20 years, 3 months ago) Reply with QuoteBack to Top

Code:
open (list, "<$listdata") or &error("Unable to open the data file for reading");
while($line = <list>) {

#do processing like checking etc.
# all code comes here, that was inside foreach

}

close(list);

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Wed Dec 31, 2003 9:26 pm (20 years, 3 months ago) Reply with QuoteBack to Top

Thank you very much jayant.
I never thought it was so simple.

Happy New Year.

Best regards,

Kepler
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.199362 seconds :: 19 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme