0

I got a php script which receives some text-chunks with data. What would be the most effecient way to store them on the server for later use ?

I was considering an mysql DB, but wouldn't that be too time consuming ?

The client will send the text chunk to the phpscript every 20 sec.

Ansari
  • 8,168
  • 2
  • 23
  • 34
Stackie Overflower
  • 201
  • 1
  • 6
  • 14
  • What are you going to be doing with the data coming in? That will determine the way to store it. Are you gathering them so that you can get statistical data later? Or just to process and discard? – iWantSimpleLife Jun 25 '12 at 01:06

3 Answers3

1

Strictly speaking, the fastest way to store it is with Memcache. However that's probably far from the best way.

Storing it into a file would work reasonably well and is very simple to implement. If you only need a store/retrieve system, files are a better choice than a database.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
0

You should not use Database for that, but File System. You might consider of using AWS S3 also. Take a look at [Storing a file in a database as opposed to the file system] and [Storing files in database Vs file system]

Community
  • 1
  • 1
Roman Newaza
  • 11,405
  • 11
  • 58
  • 89
0

Given that the time delay is 20 seconds, the answer depends entirely on how you want to retrieve the text. You could store it in a flat file if retrieval is easy that way, or in a MySQL database if you need to perform relational queries on it, or in an in-memory data structure like a Zope object database that backs up to disk, or simply an in-memory cache like Memcached if you don't need to store it for long.

20 seconds is a long time for any of these ways so pick the one that makes it easiest for you to retrieve it the way you need to.

Ansari
  • 8,168
  • 2
  • 23
  • 34