0

I am developing a Spring Based Web Application which will handle large volume of requests per minute and this web app needs to respond very quickly. For this purpose, We decided to implement a flat-file based queuing mechanism, which would just write the requests (set of database columns values) to flat files and another process would pick this data from flat files periodically and write it to the database. I pick up only those files that am done writing with.

As am using a flat file, For each request I receive, I need to open and close the flat file inside my controller method.

My Question is : Is there a better way to implement this solution ? JMS is out of scope as we don't have the infrastructure right now. If this file based approach seems good, then is there a better way to reduce the file I/O ? With the current design, I open/write/close the flat file for each web request received, which I know is bad. :(

Env : SpringSource ToolSuite, Apache/Tomcat with back-end as Oracle.

Alex
  • 1

1 Answers1

0

File access has to be synchronized, otherwise you'll corrupt it. Synchronized access clashes with the large volume of requests you plan.

Take a look at things like Kestrel or just go with a database like SQLite (at least you can delegate the synchronization burden)

Federico Fissore
  • 712
  • 4
  • 18