Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4272478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:34:59+00:00 2026-05-21T07:34:59+00:00

I’m building an app to serve large amounts of data via REST API and

  • 0

I’m building an app to serve large amounts of data via REST API and I’m looking for some inputs on how to architecture it. I’m using .NET (C# 4.0), ASP.NET MVC and Sql Server 2008.

Right now I have about 400k rows in a relational database with +- 5% of it updated through the day by an internal app that goes directly to the database. I need to serve this data via a REST API returning a custom format of XML. However, the data needs to be processed before I can output it. The good thing is that I can pre-process it before if needed.

I wrote a small POC that gets the data, process it and cache it into a local XML file. Due to processing this process takes about an hour to work on all 400k rows. After the cache is done I just return the physical file in every request.

Now I need to be able to update the data as it gets updated in the source and update my cache so I don´t need to generate everything everytime a single row gets updated.

I’m thinking about using AppFabric to keep a memory cache and use physical files just to make sure that in case the memory cache goes out I don’t need to start from scratch. As soon as a row gets updated in the source I would update the cache memory and write the physical file to make sure its up to date.

So my primary source would be the AppFabric cache, then the physical cache file and as a last resort regenerate the file from the database what would take about an hour and make the file unavailable to whoever calls it.

I’m not very happy with this, but it is what I got. Any suggestions?

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:35:00+00:00Added an answer on May 21, 2026 at 7:35 am

    Thanks for your clarification above. Here’s an option based on that.

    Add a table to your DB. Call it Products_Processed (or Prices, whatever). This new table has one row for each row in Products (eg, 1-to-1 with the source data). Each row in this new table contains the processed data for the corresponding source row.

    Each time a row is updated in Products by the external app, you compute just that row and update the corresponding row in Products_Processed.

    Here are a few ways to get get code run on just the newly updated entries:

    • Have a thread in your program that polls the DB once a second (or minute) runs your processing logic on any rows updated in the last second since one second (or minute) ago. This implies you keep a timestamp on when the Product row was updated (which is probably a good idea anyway).
    • If you don’t want a timestamp, have a trigger in the DB on your Products table that adds updated rows to a Products_ToProcess table. Poll that and run your processing logic on entries that appear there, and remove from Products_ToProcess
    • Use a trigger on the products table that actually calls your C# code: Create and Run CLR SQLServer Trigger

    This approach keeps your derived data logically close to the source of truth (in the DB with the source data) and reduces the number of times you copy/format/handle the data. Also, importantly, using the tried-and-true DB-provided mechanisms for detecting/triggering on changed data will save you from writing a lot of your own syncing code.

    Now, returning your results is essentially streaming out a select * from Products_Processed. If you want to return the processed data for just specific products, you have the full power of SQL and your schema; likewise for sorting. This whole setup should be fast enough that you don’t need to cache the file on disk. In fact, MSSQL caching should probably keep the most/all of the processed data rows in RAM if you have enough, so you’ll rarely have to do a cold select (and if you don’t have enough RAM, consider what a few extra gigs are worth compared to your time; throwing hardware at a problem is never cheating ;).

    (However, if you really want to write it out to disk, you can store the offsets into the physical file for each row record, and quickly update individual data in the file as the corresponding processed data row is updated.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.