Solved

Servlet: Slow transfer of serialized data over network

Posted on 2007-03-21
14
363 Views
Last Modified: 2013-11-24
Hi,

I wish to save the data from my Applet to the server through Servlet.
I am serializing the vector data over the network and sending through URLConnection.
But the readObject() method on the remote servlet is very slow in reading the data.
It takes over 4 minutes for the same.
However on the local machine, similar method just takes 2-3 seconds.

Can someone please help me so that my serialized data transfer to Servlet is fast.
I intend to do the job in not more than few seconds.
Thanks in advance.

Best regards,
Rahul
0
Comment
Question by:rahul_asanikar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +1
14 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18769171
What is the data that you are storing in the Vector? Try using an ArrayList instead though I doubt if it will affect serialization/ deserialization speed.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18769293
Use BufferedInputStream to read the data.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 18777926
what kind of data it is? if its all primitive types ( string, integer etc).. you might be able to send them thru on plain HTTP protocol
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:rahul_asanikar
ID: 18785381
I am having an ImageIcon object (the image to be saved on server) and a String (image name) in the vector.
Unfortunately, ArrayList and BufferedInputStream don't seem to help much.
Guess if it vector data is compressed, the amount of data to be transferred would decrease.
Do give your opinion in this regard or any other options available.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18785422
Did you try BufferedInputStream?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18785666
What objects are you passing in the Vector?
0
 

Author Comment

by:rahul_asanikar
ID: 18788666
I tried BufferedInputStream to read the serialized data on servlet, but could not find any benefit.
The data in my vector is an image (ImageIcon object) and a String (the image name).
The image is supposed to be saved on the server with the given name through servlet.
The image save time has become a performance bottleneck!!
So the problem needs to be quickly solved.
0
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 63 total points
ID: 18788706
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18788838
Try serializing the object to bytes and sending the byte[] array in chunks using a BufferedOutputStream and read on the other end using BufferedInputStream - similar to what Ajay had said earlier.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18788840
Also, if there are users waiting for this operation to be completed before they can do something else, maybe do this in another thread.
0
 

Author Comment

by:rahul_asanikar
ID: 18832881
My Applet gives security exception when tried to implement XMLEncoder.
Basically, the security policies of the Applet prevents the operation.

Just wish to add that my ImageIcon object is derived from an Image object that is created on the fly.
The image is created based on what the user draws using the Applet.
Hence, would prefer to wait for the image save in the same thread as the user should not be allowed to update the image contents during the process.

Please let me know if any other solution would help me save the image on server in just few seconds.
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 62 total points
ID: 19047263
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question