Best way to implement extremely heavy calculation?

R

roygon

Hello,

I have a C# application that runs a relatively complex simulation
which, on a typical computer, could take up to 10 seconds. I am now
trying to port this application over to ASP.NET so obviously this
calculation needs to happen on the client. What is the best way to
implement this?

Some more information - all of the code needed to run this is located
in 3 or 4 C# dll's so at a high level I would simply look at the user
inputs on the web form and setup the simulation which would run on the
client and then have the ASP.NET page take the output and display the
results accordingly.

Now what is the most effective way to make this run on the client? If
I just include the classes in my project then it will run on the
server. Do I package this up into an ActiveX control that gets
deployed to the client? I do not want the code to be viewable (which I
think rules out using a client side scripting language) and I would not
want the user to be able to reuse this component in their own
application. It should be simple to run (so no client side
configuration beyond clicking on an "ok" prompt) and ideally would run
on any recent browser although I suspect that this last option won't be
doable.

Any help would be appreciated,

Roy
 
K

Kevin Frey

I'm not sure why you say "obviously this calculation needs to happen on the
client" because it's not obvious from your post why it must be done on the
client, unless it is the computational load itself that you feel demands
this (in which case I'd be starting to think about how often each user might
be doing the simulation, and how many users you might have to give you an
indication of how beefy a server you might need).

But assuming you *do* need to do it on the client... you might wish to read
up on Smart Clients and see if that provides any help to you.

Kevin
 
R

roygon

Thanks for the response. Perhaps "obviously" was not the correct
wording given the description. The ten seconds of computing time is
essentially at 100% CPU usage and there will be many requests per
second. Additionally, server resources are a constraint. So, for the
sake of discussion, let's say that running this calculation on the
server is not an option.

I have briefly looked into smart clients but from what I have seen it
does not achieve what I am looking for. I already have a windows
client so for those people willing to download the application I
already have a good, working solution. What I wanted for this web
based implementation was broad access without a software download /
installation. Almost all of my .NET development has been on
traditional client applications so I'm not fully aware of all of my
options.

I think I have three options but I am not sure if this is correct and
if I fully understand the implications.

1) Build the app in Java - I believe that by doing this the user would
essentally download the app within the browser and execute the
appropriate code on their own PC without exposing the code itself.
There would be a bit of a learning curve though for me here since I
have minimal java experience and I don't believe I will be able to use
my C# components although I could be wrong here.

2) Use Atlas - no idea if this is an option but it seems like there
might be some facilities to run fairly complex code on the client side
through an Atlas application.

3) Build the processing code into ActiveX components that are hosted on
the page

Does anyone have feedback on what I think my options are and how
effective they might be and also, have I missed any obvious choices?

Thanks,

Roy
 
A

Alex D.

Well if you use Atlas I believe your calculations will still be runing in
server side since atlas is an AJAX implementation for .NET.
I think your optionas are activex, java applets, or exposing the source in a
javascript class. You also can use a combination of things you want to hide
from the user and things you can do in the client side things, so your cpu
ussage will be diveiden between client and server. does that makes sense?

alex.
 
W

William Buchanan

I think that the Javascript idea is a good one (at least well worth looking
at). It would definately be the easiest to deploy.

The problem with all the other ideas is that you end up with loads of
security restrictions which stop them from working. This leaves you with the
problem of users needing to configure their browser properly. Also, with
Java, you need to have the correct version of the Java Virtual Machine
installed on the client. Off course they will also need to download the
ActiveX / Java applet.

Will
 
R

roygon

I was considering that but the issue I have with javascript is that the
heavy code that is required to run on the client is also where the
intellectual property of my application is located so I can't really
offload the processing without exposing my entire product if I use a
client script! So, unfortunately that option is out. It looks like an
ActiveX control is likely going to be my best bet.

Thanks,

Roy
 
A

Alex D.

I couldnt agree more.

William Buchanan said:
I think that the Javascript idea is a good one (at least well worth looking
at). It would definately be the easiest to deploy.

The problem with all the other ideas is that you end up with loads of
security restrictions which stop them from working. This leaves you with
the problem of users needing to configure their browser properly. Also,
with Java, you need to have the correct version of the Java Virtual
Machine installed on the client. Off course they will also need to
download the ActiveX / Java applet.

Will
 
A

Alex D.

also there are some javascript code scramblers out there. google for
"javascript scrambler"
 
K

Kevin Frey

I would still entertain running the computation on the server, or via an
Ajax call to a server, since there is no requirement that you only need
*one* server handling the requests.

Using a round-robin DNS for example, all clients might access
"site.company.com" and be directed to one of many servers to service the
request. Assuming the computation is relatively self-contained, I think you
could do that easily.

I always try avoid tying myself too closely to a particular platform or
browser, which ActiveX is gonna do to you.

Kevin
 
R

Russell

If the code is all calculations, no local resource access, then the
JAVA security model will not be a problem.

If you know C#, porting your code to JAVA should be pretty easy. The
languages are VERY similar.

It's a little trickier getting data back from the applet to the form...
O'Reilly has several JAVA books, one covers this. Of course, the
applet could also post the data back itself.

Because ActiveX controls have little to no security framework, a lot of
people disable them.

Your users will need the right JAVA plug-in, but the browser will
prompt them for it.

--Russell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top