Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So, I am not expert at Node.js, but from what I was looking at with Node.js it seems possible.

I am trying to cache data (A and B below) on the client (client 1 below) so that I can get that data on the event of a cache miss on the server rather then going to the database to retrieve the data. Ultimately, I would like to have a java script on the client that communicates with node.js to accomplish this.

I am trying to reduce my cache size on the edge server and decrease my source server load, by utilizing client storage / communications with node.js

Scenario: Data A and B; Client 1 and 2, and edge server

  1. Client 1 requests A, and is sent A and B
  2. Client 2 requests B, and the edge server doesn't have B in the cache.
  3. Client 1 is still connected, So using Node.js server push, B is retrieved from Client 1 and sent to Client 2.
share|improve this question
2  
What problem are you actually trying to solve? It isn't clear what you want to accomplish? Also your question refers to Client 1, Client 2, Client A and Client B. That seems very confusing. –  jfriend00 Nov 2 '14 at 22:50
    
sorry for the confusion. I have corrected my question –  CptLeftFeild Nov 3 '14 at 0:14
    
You're still referring to Client 1, Client 2, Client A and Client B. Are there four clients involved here? And, are you trying to have one client get cached data from another client, but via a connection through the node server? I have no idea why you'd do that - why not just put a cache in your node server so you can control exactly what should be cached, control it's lifetime and cache validity and easily serve it to any client of interest? –  jfriend00 Nov 3 '14 at 0:18
    
2 clients and 2 data objects. well my edge server has limited capacity, and I don't have control of the source server. I just want to make sure its possible, and then I will tests the concepts efficiency rather then going back to the source server. 1) reason would be if my edge server cache became full, then I could offload that to clients, the client is likely closer then the source server. 2) It would allow me to pre push data to clients, that they may need in the future. –  CptLeftFeild Nov 3 '14 at 0:23
1  
Just keep in mind that clients are notoriously bad servers (unreliable uptime, unknown availability, typically slow upload speeds). Yes, of course, you can code anything using a persistent connection like a WebSocket. Just because you can doesn't necessarily mean it's the best design choice, but you haven't shared enough particulars for us to do more than comment that it's highly unusualfor typically sound reasons (servers are better at being a central cache than clients are). Obviously, there are client-side cache systems like the old Napster or BitTorrent so it can be done. –  jfriend00 Nov 3 '14 at 1:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.