1

So I'm writing a program that needs to scan the user's music library and then retrieve metadata on the tracks they have from a central server. I expect that each track will have roughly 100 bytes of metadata returned on average, so if the user has 10,000 tracks, that's a about 1MB I'll need to transfer from the server to the client. Are there any good suggestions for this?

One option I have in mind is to submit the track info as an HTTP POST request, and then use PHP to format the metadata into one big XML response containing all the information. But it seems wasteful to format the data into XML and then parse it on the iPhone. So I'm wondering if there's a more efficient way. I suppose another option would be to write my own daemon and use raw TCP, but it seems like it would possibly be overkill. The most important thing to me is to minimize retrieval and decoding time.

acjay
  • 34,571
  • 6
  • 57
  • 100
  • You could break it up in chunks and ask the server for the meta data for 100 or 1000 tracks at a time, and do a few connections in parallel. – onnoweb Nov 14 '11 at 17:24
  • That seems reasonable, but I could really use specific architectural suggestions. – acjay Nov 14 '11 at 18:16
  • I believe architecture ends with "1MB I'll need to transfer from the server to the client". The exact way is really up to you. Either TCP or XML, you still need data transfer. You could also consider json-formatted response, with response deflation it would be not so large. I assume there should be json deserialiser available. You could also cache serialized data at server for future use. – mikalai Nov 15 '11 at 15:32
  • Okay...let me be more specific. I'm looking for best-practice-style recommendations from folks who may have experience with this type of problem in the past--I know it would work to use XML or JSON, and those would certainly to be the easiest options to use, but with 1MB of data, would the deserialization process affect performance in a major way? Would rolling my own TCP solution be worth the effort, or are there better ready-made solutions for transferring platform-independent serialized data, with minimal deserialization time? – acjay Nov 15 '11 at 18:14

1 Answers1

1

With more research, I came to the conclusion that using an API platform built on the database was the simplest route. I never completed the project, but the best bet seemed to be writing a server in a language like node.js, serving data in JSON format. I also looked into using BSON to save transmission and processing time.

acjay
  • 34,571
  • 6
  • 57
  • 100