Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How/where to store temp files and logs for a cloud app?

I am working on a Python/MySQL cloud app with a fairly complex architecture. Operating this system (currently) generates temporary files (plain text, YAML) and log files and I had intended to store them on the filesystem.

However, our prospective cloud operator only provides a temporary, non-persistent filesystem to apps. This means that the initial approach with storing the temporary and log files won't work.

There must be a standard approach to solving this problem which I am not aware of. I don't want to use object storage like S3 because it would extend the current stack and add complexity. But I have the possibility to install an additional, dedicated app (if there is anything made for this purpose) on a different server with the same provider. The only limitation is that it would have to be in PHP, Python, MySQL.

The generic question: What is the standard approach to storing files when no persistent filesystem is available?

And for my specific case: Is there any solution using Python and/or MySQL which is simple and quick to implement? Is this a usecase for Redis?

like image 932
boadescriptor Avatar asked Apr 15 '15 17:04

boadescriptor


People also ask

Where should temporary files be stored?

Temp files often have the extension . TMP and are stored in the C:\Users\AppData\Local\Temp folder. If you're working on a document, your word-processing app may create a temporary file to track your progress.

What is the name of the location of temporary data storage on applications?

Caches are temporary stores of data that can exist in both hardware and software. Cache memory refers to the specific hardware component that allows computers to create caches at various levels of the network.

Where is was temp cache?

C:\Users\[username]\AppData\Local\Microsoft\Windows\INetCache: This temp files location is relevant in Windows 10 and Windows 8. C:\Users\[username]\AppData\Local\Microsoft\Windows\Temporary Internet Files: This is where temporary internet files are stored in Windows 7 and Windows Vista.

Can I delete log files in Windows temp?

Find where your temp files are stored by pressing and holding the Windows button, and then hit R to bring up the Run dialogue box. Type temp and press Enter (or click OK) to open up the folder location and see your temp files. Hold Ctrl and click individual items to select them for cleanup.


2 Answers

Redis is a bad choice for this problem. It keeps all data in memory, so it's expensive and not practical for long term keeping of log files.

MySql is OK, however MongoDB is a more flaxible and fast solution. Actually it's one of it's main use cases: https://docs.mongodb.com/ecosystem/use-cases/storing-log-data/

like image 43
O_Z Avatar answered Sep 19 '22 07:09

O_Z


As you are asking two questions, let me also answer them one by one:

The generic question: What is the standard approach to storing files when no persistent filesystem is available?

If the contents of a file are not suitable for regular database storage, but you really want to store the file itself (like images, binaries, etc) persistently, Amazon S3 and similar services are usually your way to go. There are also free alternatives available like Riak, Aerospike or the more heavy Cassandra.

While all of these services are free (or have free versions available), they would require setup and ongoing maintenance. Also you are very unlikely to achieve the same levels of availability and scalability as hosted cloud services like S3 have. If you account for this, the savings by not using a cloud service like S3 are questionable at least. But as always, YMMV.

And for my specific case: Is there any solution using Python and/or MySQL which is simple and quick to implement? Is this a usecase for Redis?

Your question is a little bit contradictory. You mention your application generates temporary files, yet you don't want to lose them?

If your files are temporary, a solution like Redis or memcached would be perfectly suitable for the job, as long as you have the understanding that both are caches and data will be lost on restart, or (if enabling Redis snapshots) at least don't guarantee that writes are persisted to disk.

If you do not want to extend your stack, and Redis does not give you the levels of guarantees you are looking for, MySQL supports the storage of blobs, which can be used for storing files (binary data) in MySQL. This generally does not scale very well, but again, deciding whether this is acceptable for you highly depends on your situation. (See also this excellent answer regarding the pro's and con's of storing files in MySQL.)

like image 168
Rick Avatar answered Sep 22 '22 07:09

Rick