DEV Community

fullstackplus
fullstackplus

Posted on

1

Choosing a storage solution for simple user input

Hi everyone,

here's an engineer-y question for you regarding lead generation online.

Say you had to collect your visitors' name & email through a landing page opt-in. What storage mechanism would you use:

  • a JSON file
  • a key-value store
  • a relational DB?

My current solution is a JSON file, however it's not very efficient because when saving a new entry, you need to parse all the existing ones into an Array from JSON, add the new data, then again serialize the entire collection as JSON, then write it back to the file.

Also, if I'm going to do uniqueness tests (no double entries allowed for email, for example), I'll have to traverse the entire array to find the duplicate — I suspect this is more efficiently handled by the other two storage mechanisms (hash-based lookup in constant time).

Thanx for your input!

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry 🕒

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)