Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

To cache binaries as a BLOB or on file system?

Advocate ,
Sep 08, 2010 Sep 08, 2010

I originally posted this AIR question on the Flex forum, which didn't get much attention, so now I am trying here which seems more ideal.

My question in detail:

     Would it be more optimal to store binaries (Images and SWFs) as BLOBs in the database or to have a URI pointing to them on the user’s file system?

I am primarily a Flex developer which hasn't had much development time with databases but realizes there are 2 options to take for storing binaries in an AIR application.  Since I haven't been exposed to db development I am not sure which is the preferred way.

TOPICS
Database access
589
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Sep 09, 2010 Sep 09, 2010

You are right there are two options, and they are both commonly used.

Storing on the file system is a bit easier to implement for many and might be a touch more proformant with less encoding and decoding going on.  But it has a higher risk of syncornazation  problems since there are many ways for the file objects to be modified, moved or removed without changing anything and the database.  Thus one should build logic that will check for the actual existence of the file at the URI before trying to

...
Translate
Valorous Hero ,
Sep 09, 2010 Sep 09, 2010

You are right there are two options, and they are both commonly used.

Storing on the file system is a bit easier to implement for many and might be a touch more proformant with less encoding and decoding going on.  But it has a higher risk of syncornazation  problems since there are many ways for the file objects to be modified, moved or removed without changing anything and the database.  Thus one should build logic that will check for the actual existence of the file at the URI before trying to serve it up.

Storing the file in the database mitigates the issues with syncornazation.  But it takes a bit more to set up and could involve a lot more data in the database itself, which may or may not be an issue depending on ones setup.

But either is an acceptiable choice and just work with the various pros and cons of either.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 10, 2010 Sep 10, 2010
LATEST

ilssac, thanks for the feedback!

I think I am going to try to save the binaries directly in the database.  Saving a binary on the file system would involve 2 easy steps:  storing the URI in the db and saving the binary on the file system.  But as you mentioned there are risks involved.

I started this task yesterday and I am saving BLOBs to the db, but will now just need to decode them when requested.  If the performance is good when decoding them, I believe I will stay with this option.  If not, I will resort to storing them on the file system.

Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources