• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Websphere to busy (100%) after request for downloading file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I send some data files until 12 mbytes to client,
if an user visit my index.jsp and call my link href="download.jsp".

first problem:
- during the download the server is busy with 100%
- download takes more time 20 minutes or more
- download rate is only 7 kbyte per second
- client is an internet explorer version 5xx until 6xx
- my code snippet on server:
PrintWriter pw = response.getWriter();
IModule module = createModule();
module.write(pw); // here only pw.write(...) init
pw.flush();
pw.close();
- other users have to wait long for their requests

second poblem:
- if an user closed the internet explorer, the server will not feel this event and do not stop sending data... until all data are send.
- if an user answer the pop up of internet explorer for downloading with "cancel", the server will be also not stop sending data... until all data are send.

What solutions are there? Could be threads usefully? How are their using in my java code on websphere?
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the 100% usage is because you're letting the server filter the entire contents of the data, which it doesn't need to do. Why its taking so long and going so slowly, not quite sure although I'd wonder if there were any network problems.

Is it possible to give the user a direct link to the file? If so, this would be the ideal solution since then the application doesn't need to get involved in reading/writing the contents of the file. Of course, you lose security this way.

In general, you may want to use a separate web server for serving static content since WebSphere's primarily role is not as a static content provider. Refer to this article for more information:

http://www-128.ibm.com/developerworks/websphere/techjournal/0211_brown/brown.html
 
Marian Kulisch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The solution was to use less new java objects during write some output in the outputstream.

before solution:
- client will download huge dynamic file from websphere
- websphere is than busy 100%
- data download number is slow, only 20 kbyte to 7 kbyte per second

My huge dynamic created file of up to 12 mbyte was created from more than thousands of java objects. In an LOOP I had make always a copy of this objects, and progress some working steps of this copies, than write the content in the outputstream. The garbage collection has a lot to do...

after:
All thousands data objects will be copy in an loop into ONE cleared data object, only this data object will be prepare for output, than write output into outputstream. The garbage collection now has not many to do...
now the data download number is nice with 500 kbyte per second.

- client will download huge dynamic file from websphere
- websphere is than busy 100%
- data download number is fast approximatly 500 kbyte per second

my experience:
- websphere based on java
- java is slow, not developed for operating with more than thousand of java objects in short time
- garbage collection makes output from webshpere by outputstream very slow
- websphere is slow

open questions:
a - is there an switch to make websphere faster?
b - is websphere only for one client request at same time?
c - why an second client have to wait until an old request is finished?
d - if client closed the internet explorer during download of data from websphere or break up download, websphere sends always data ... not be able to see that client is closed or broken download...
e - who developed websphere? (joke)
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While WebSphere is slow (a lot slower than java), I suspect if its still taking 20 minutes for a 12 megabyte file something else is wrong.

Can you go into more detail about your data, where its coming from how its being built. Is there a database involed? Do you have metrics for how long it takes to create the file without sending it to the user? You should also consider a caching mechanism for objects read over and over again.

It sounds like your solution fixes the biggest bottleneck since 500 kbs is pretty good for any server. Its easy to give up and blame java/websphere, but there often tuning steps, such as the one you all ready did, that make it faster. The server can only do what you program to do.
 
reply
    Bookmark Topic Watch Topic
  • New Topic