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 227615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:36:48+00:00 2026-05-11T19:36:48+00:00

We are testing an application that is supposed to display real time data for

  • 0

We are testing an application that is supposed to display real time data for multiple users on a 1 second basis. New data of 128 rows is inserted each one second by the server application into an SQL datatbase then it has to be queried by all users along with another old referential 128 rows.

We tested the query time and it didn’t exceed 30 milliseonds; also the interface function that invokes the query didn’t take more than 50 milliseconds with processing the data and all

We developed a testing application that creates a thread and an SQL connection per each user. The user issues 7 queries each 1 second. Everything starts fine, and no user takes more than 300 milliseconds for the 7 data series ( queries ). However, after 10 minutes, the latency exceeds 1 second and keeps on increasing. We don’t know if the problem is from the SQL server 2008 handling multiple requests at the same time, and how to overcome such a problem.

Here’s our testing client if it might help. Note that the client and server are made on the same 8 CPU machine with 8 GB RAM. Now we’re questioning whether the database might not be the optimal solution for us.

   class Program
{
    static void Main(string[] args)
    {   
        Console.WriteLine("Enter  Number of threads");
        int threads = int.Parse(Console.ReadLine());
        ArrayList l = new ArrayList();
        for (int i = 0; i < threads; i++)
        {
            User u = new User();
            Thread th = new Thread(u.Start);
            th.IsBackground = true;
            th.Start();
            l.Add(u);
            l.Add(th);
        }
        Thread.CurrentThread.Join();
        GC.KeepAlive(l);
    }
}
class User
{
    BusinessServer client ; // the data base interface dll
    public static int usernumber =0 ;

    static TextWriter log;
    public User()
    {
        client = new BusinessServer(); // creates an SQL connection in the constructor
        Interlocked.Increment(ref usernumber);
    }

    public static void SetLog(int processnumber)
    {
        log = TextWriter.Synchronized(new StreamWriter(processnumber + ".txt"));
    }
    public void Start()
    {
        Dictionary<short, symbolStruct> companiesdic = client.getSymbolData();
        short [] symbolids=companiesdic.Keys.ToArray();
        Stopwatch sw = new Stopwatch();
        while (true)
        {

            int current;
            sw.Start();
            current = client.getMaxCurrentBarTime();
            for (int j = 0; j < 7; j++)
            {   
                client.getValueAverage(dataType.mv, symbolids,
                    action.Add, actionType.Buy,
                    calculationType.type1,
                    weightType.freeFloatingShares, null, 10, current, functionBehaviour.difference); // this is the function that has the queries

            }
            sw.Stop();
            Console.WriteLine(DateTime.Now.ToString("hh:mm:ss") + "\t" + sw.ElapsedMilliseconds);
            if (sw.ElapsedMilliseconds > 1000)
            {
                Console.WriteLine("warning");
            }
            sw.Reset();

            long diff = 0;//(1000 - sw.ElapsedMilliseconds);
            long sleep = diff > 0 ? diff : 1000;
            Thread.Sleep((int)sleep);
        }
    }



}
  • 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-11T19:36:48+00:00Added an answer on May 11, 2026 at 7:36 pm

    I would suspect the query itself. While it may not take much time on an empty database, as the amount of data grows it may require more and more time depending on how the look up is done. Have you examined the query plan to make sure that it is doing index lookups instead of table scans to find the data? If not, perhaps introducing some indexes would help.

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

Sidebar

Ask A Question

Stats

  • Questions 173k
  • Answers 173k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The solution is <a href='{% url page_view slug="TermsAndConditions" %}'>Terms and… May 12, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer If you know the specific column index, then you can… May 12, 2026 at 2:36 pm
  • Editorial Team
    Editorial Team added an answer Harold's answer pointed me in the right direction. This is… May 12, 2026 at 2:36 pm

Related Questions

We are getting very slow compile times, which can take upwards of 20+ minutes
At the office we are currently writing an application that will generate XML files
I am maintaining an application that uses SetupDiGetDeviceInterfaceDetail() to find out information on the
We are implementing a C# application that needs to make large numbers of socket

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.