views:

158

answers:

3

Hi,

I have a webform with quite a few fields (between 15 to 40, based on user options). When user ends filling the form, I block it with jQuery.blockUI, and then on Server Side I process the form, packing it on an xml and call a new page. But transition between pages usually takes about 1 or 2 seconds, and I want to reduce it.

It's possible to make all processing on the next page, as the data is then send to external web services and wait for a response. That takes up to 2 minutes, thus 1 or 2 seconds are less to notice there.

So, Is there a simple way to make all data processing, and still reduce transition time?

Thanks in advance

UPDATE: I'm pretty sure that would be the better aproach. But right know time is top priority, and I'm convinced that I know the bottle neck and have no little idea as how to solve or speed up the parsing of the data to an xml that has nearly 200 fields (about 50 come from the form, rest from queries or code).

On a side note, that 2 secs are come not only from data parsing, but from our slow out conection on the development server, and connection speed on Spain in general. I'm 80% sure that it won't be as slow on the production server, but don't want to run the risk of asuming that nothing can be speed up.

Then, the couple of minutes querying external web services is out of my hands. It contacts a provider's webservice that links to a couple of Car Insurance companies, that get the data and throw out a list of insurance ¿prices? (sorry, don't know the correct word). And as this is lost time I think I can hide that two seconds of XML construction here.

The only thing I don't know is how to send form values from the Form to the Results page, that loads the data with Ajax.

+2  A: 

I think you need to focus on why it takes so long processing 40 fields. What are the potential bottlenecks on the backend? What queries are you performing that take so long? If you can reduce the processing time to less than 10 seconds you can get away with your page handling the processing otherwise you need a different architecture like REST or NServiceBus to off load the long running execution and somehow notify the client that you are done.

David Robbins
+2  A: 

You could try to do the processing in a different thread. Just take in the string, spin of the thread and return the result. Unfortunately thread programming doesn't qualify as "simple". Btw typically now is perceived as anything below 3 sec.

stwissel
Yes, I think about this before, but rigth know It's out of my knowledge as to use it on a public site that may have medium number of visits (so I hope ...)I'll try to get to threading later
MaLKaV_eS
A: 

I re-read your question and sorry for not thinking of asking first: do you have to parse the form back to XML? Is it possible to serialize your data to JSON, pass it up to the server, de-serialize and make the web request? The JSON format is much "lighter" than XML and you serialize and de-serialize with a library such as JSON.Net. This should eliminate some of your processing overhead.

With respects to the web service you call, is the data new on each request? Is there anyway of requesting less data or storing portions of the data and refreshing periodically? Potentially you could run a messaging server such as MSMQ and refresh your data on a scheduled basis and then only request what you need once you have the user specific data. 30 seconds is 30 seconds.

I keep thinking about the data - you say you have over 200 fields. I am unclear as to whether you have to perform queries or calculations. If you have numerous records, have you considered a different type of schema that might make your retrievals faster? Can you pull static lookups into a shared memory so you don't have to hit the disk?

David Robbins
What I'm trying to build is an insurance calculator. User inputs its data: age, civil state, vehicle, insurance history... Then I send this data to insurance companies, through a third party web service (XML) and over JSON to a couple of companies that serve the data through their on connection. So, parsing to XML is mandatory. A lot of fields are decision based (number of drivers for example), and others are retrieved from database. That's why I think it's better to process the data on the second page.
MaLKaV_eS
Wow, I'm rereading the comment, an I didn't answer your last question... Have to make it shorter... I perform queries to third party's services. They perform the calculations. And data is usually new for each new user.
MaLKaV_eS