The stupid question is the question not asked | |
PerlMonks |
Maintaining State efficiently for large numbers of statecodesby Angel (Friar) |
on Sep 08, 2003 at 13:47 UTC ( [id://289770]=perlquestion: print w/replies, xml ) | Need Help?? |
Angel has asked for the wisdom of the Perl Monks concerning the following question: I am asking this as a hypothetical with some serious applications and I hope that this may help someone else in the future. I wrote a data entry web application with states in it. I was not aware of CGI::Application or any of the state modules so it took in data and time issued and generated a key made of an MD5 and a random component that allowed me to get the data back out when the page came back. This was stored in a MySQL database. FUNCTION MAKE_STATECODEARGUMENTS:
RETURNS: A code of speccified length that refers to the data stored in a table allowing the end user to only get the information and pages pertaining to him or her. This worked really well when I was generating at most five or six codes per page. And we used it for two years. But I worked out a script that masks SQL tables or views and can auto generate tables and forms. I did see some of them in cpan but I did not like the API. Anyway I was generating one statecode for each record to link to each editable record page. I banged it up so serverely trying to get it to work. That I dont want to show the really ugly code but i will explain the algorithm.
Then things started to slow way down when I needed a bunch of statecodes ( 1000+ ). I pre-compiled the statement by moving the prepare out of the loop and that helped but not enougth. Multiple inserts did not help much either since the problem is the speed of which data is exchanged between my server and my database server. We are talking about 10 linkcodes a second. Thus I need a new state module to wrap my existing module around so that the rest of the program is unaware. ( OO rocks! ) what do you reccomend. My disk space is mapped so having it running on several servers at the same time is not an issue. What I am concerned with is when I pull the data out when the statecode comes back if I do use a flat text file when I have two big tables in use ( which is only for admin view ) thats 4 K linkcodes plus the users and every retrieve is doing a linear search. Any ideas since using CGI::Session is just going to put me in the same situation.
Back to
Seekers of Perl Wisdom
|
|