• Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking for efficient way to do data delivery.  RSS feed

 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm looking for the most efficient way to do data delivery to clients.
Basically I need to provide data to clients in XML format every time the they access a URL.
The XML data will be created based on data on a table.

I'm comparing between two approaches:
1. Create a file every time clients request it. And then redirect clients to this file.
2. Return a String of the XML to client (create on-the-fly).

Based on my experiment, creating the data on-the-fly would be faster since we don't have to do disk access.

Is it always better to create everything in the memory than creating it on disk and then access it again? I'm just afraid I'm missing something important that I didn't realize before.

Thanks in advance for all the advice.

Rudy
 
Paul Clapham
Sheriff
Posts: 22817
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, something important you have missed is, how big is the data you're proposing to send to the client? If it's measured in megabytes then it would be worth designing some caching system to avoid having to regenerate large amounts of data all the time. But if it's measured in kilobytes then just generate the data on every request and be done with it. Don't write to disk, just stream it. Until you find you need better performance, of course, but to start with just do the simplest thing that will work.
 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Actually the data sometimes big sometimes small. It really depends on what kind of service the client subscribe for.

1. Is creating data to disk and read it from disk never a good idea?

2. I'm also thinking about how to make it secure. I'm thinking to create a JSP page for client to access and the authentication will be done by tomcat. Based on my understanding this will be pretty secure? Is there any downside from doing it this way?

3. I'm not too familiar about caching techniques. Can you point me to the right direction? Maybe some good links that I can study from?

Thanks again for all the help.
- Rudy -
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caching: there are lots of projects on caching - Whirlycache seems to be well supported.

Bill
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!