|
Data is not that big as it is only a kind of look up data (like our standards for the app that never changes). Rest we have whole db from which we are getting data at run time. I checked time of all these calls. There are few methods(2-3) which takes 1-1.5, rest are either 0.001 sec - .4 sec.
Our app is internal business app having around 2000 users and we are already using NetTcp Binding
|
|
|
|
|
Ok, so 3 * 1.5 = 4.5s, 20 * .05 (avg) = 1s. So lets say on average just your start up cost is going to be 4s to 6s.
If you are spending 5s to load app standards and resources that never change, why not just embed them into the app as an XML file or something? Or if you are super paranoid about having to change them some day, implement a caching mechanism. I.e. download the resources and keep a version number. You have version 1.0. Do a single WCF call and see that the current version is 1.1, so you need to re-rab the data. Otherwise use the local copy.
If you have NEVER changed that stuff, its unlikely you ever will, so just embed it into the app.
But you've still only accounted for at most 6s of your start up time. Lets even say your splash screen is putting another 2s on top of that. That's still 8s and you are claiming the start up time is 15s. So where is that other 8s going to?
Usually for something like that, I have a vague idea of where to look, but if you don't, I would use the Visual Studio profiler that's built in. It's good enough for this job.
Also, instead of timing each individual call now, how long does the entire parallel load take?
Also, not sure if you are able to, but if you can, comment out all the load stuff and see how fast your app loads.
If you don't want to hunt around, just use the profiler to see where the cost is.
|
|
|
|
|
Hi Sledge,
I am able to reduce few call which includes an update on splash screen, out of 3 it is not reduced to 2 (saved 1 call).
But still need to reduce call for 1 method
System.Threading.Tasks.Parallel.Invoke(
() =>
{
SplashWindow.SetProgress("Load User Preferences...");
UserPreferences.Instance.Load();
}
;
DB call (file size is 350KB)
SELECT userPreferencesDoc
FROM Application_UserPreferences
WHERE resourceId = 99199
Rest 8 sec is all variable ... when I host service on local it reduces to 1-2 sec but on test environment 6-8 sec
How can I control network issues? any ideas
Also I will verify with profiler and will Update results
|
|
|
|
|
If it's 15s in your prod environment, and 1 - 2s locally, then I'd assume that your prod environment is not up to snuff.
* How many machines are hosting your web service in prod? hardware / memory specs? what kind of network connection? etc. From my experience with WCF, I don't think you'd be able to host 2000 simultaneous connections on one machine. Especially if its an off the shelf PC with limited hardware. You aren't going to be able to use a $2000 Dell PC for this.
* What's your SQL box look like? Is it a seperate box from the web servers? Or is it running on the same box. SQL generally requires VERY beefy hardware in a production environment. I.e. a typical production SQL box at my company is spec'ed out at 24 core Xenon + 140GB RAM + flash storage + 10Gbps backbone and there are still some performance issues.
* If you don't have the resources for a beefy SQL box, the work around for that would be to cache all this static data in the web service as static data upon start up.
What I mean is, right now it sounds like (and corret me if I'm wrong) as the app is making 20 to 30 WCF calls upon start up and those 20 to 30 WCF calls make 20 to 30 SQL calls?
A better design would be to have the WCF service make the 20 to 30 SQL calls ONCE upon start up and keep the data in static members in the exact format you will need to return them. So now all your WCF methods would just be:
return _dictWhatever;
no need to lock or syncronize anything for multi-threading in WCF since it'll be created when the service starts up.
|
|
|
|
|
Hi Sledge,
In my local environment it is taking 5-6 sec but in production 10-15 sec. This 8 sec variable is in all environment (tst,uat,prod) and I don't know how can I control
SQL is already on different VM and service is hosted on a different server.
Caching is already implemented so we we are getting most of the data from cache only.
Service is getting restarted every night and data & cache got refreshed every night. So not every service call is going to SQL call.
Issues that I am facing are
Network issues (prod is too slow than system but if we citrix app it is fast)
There is XML file (350kb) which is imported from database is consuming some time (it is not cached in service)
Also there are few Active Directory calls which is taking (methods that i talked having 0-5 sec) {used for finding groups of user etc.}
Also want to thank you for spending so much time and sharing your knowledge. Kudos !!!
|
|
|
|
|
We tried using VMs here instead of physical boxes. For us, they are too slow and we are a relatively low volume shop. Its noon here and we've only gotten 57,000 requests so far. We are a data intensive shop though, so each request takes like 4 or 5 seconds of database activity (big data).
Have you tried monitoring your web server and sql box in task manager during the day to monitor CPU and memory? If you are maxing out memory and/or CPU, you need to beef up the hardware.
|
|
|
|
|
Loading the splash-screen takes time. You can improve performance by eliminating it. I would also recommend against loading anything before the first UI is displayed. Load the UI first, then kick off a thread to load your data. Load the data using a backgroundworker with NORMAL priority. Any "high priority" thread will slow down the execution of the other running threads - it is recommended to do everything in "normal" priority.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
Loading splash screen is must for us So I can't remove it
Here name of function is loadWithHighPriority is confusing but it is just another parallel task done with normal priority but separately thus named like this.
This data we load is then used even this.loaded to fill data in UI.
|
|
|
|
|
teek13 wrote: Loading splash screen is must for us So I can't remove it You also said it was a must to become faster
I'd recommend to not load anything until the UI is present. A lot can be deferred to a later point in the application, when it is actually used.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If you want to see where all the time is really being taken up (and Sledge is onto something here), you should run a performance profiler to see what's taking the most time. Don't guess at the problem, get some actual metrics to identify what's going on.
|
|
|
|
|
|
I will see performance through profiler too and update the same
|
|
|
|
|
i want to make a program by which user can change any image into text.
|
|
|
|
|
OK - you have our permission. Go make your program.
Hint: Reposting a vague question isn't going to elicit offers of help.
/ravi
|
|
|
|
|
arvindnitin7 wrote: i want to make a program by which user can change any image into text Any image? Are you looking to generate ASCII art? Or are you talking about any image of text? In which case, you want to look into OCR.
|
|
|
|
|
i want to make a program y which user can change any image into text formate. plz help me as soon as possible.
|
|
|
|
|
"ASAP" doesn't work when talking to volunteers. We also do not help doing "projects", but we do answer specific questions. If you have one, feel free to ask.
What you want to do is called "OCR".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to Calculate Days Between Two Dates ?
if my dates are
Date1 = 2014/01/10
Date2 = 2014/10/30
Just Like
January 20
February 28
March 33
April 31
May 30
June 31
July 30
August 31
September 28
October 31
November
December
|
|
|
|
|
Try:
DateTime Date1 = new DateTime(2014, 01, 10);
DateTime Date2 = new DateTime(2014, 10, 30);
TimeSpan diff = Date2 - Date1;
Console.WriteLine(diff.TotalDays);
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Assuming you want ... given two dates ... to generate a data structure that contains each Month from the starting date to the ending date, and, for each month, the number of days in the month:
using System.Globalization;
private DateTimeFormatInfo dtf = new DateTimeFormatInfo();
private Dictionary<string, int> getMonthDays(DateTime d1, DateTime d2)
{
int nMonths = ((d2.Year - d1.Year) * 12) + d2.Month - d1.Month - 1;
var dctMonthDays = new Dictionary<string, int>();
for (int i = 0; i <= nMonths; i++)
{
int daysInMonth = DateTime.DaysInMonth(d1.Year, d1.Month);
string monthName = dtf.GetMonthName(d1.Month);
if (i == 0)
{
dctMonthDays.Add(monthName, daysInMonth - d1.Day);
}
else if (i == nMonths)
{
dctMonthDays.Add(monthName, d2.Day);
}
else
{
dctMonthDays.Add(monthName, daysInMonth);
}
d1 = d1.AddMonths(1);
}
return dctMonthDays;
}
DateTime d1 = DateTime.Now;
DateTime d2 = d1.AddMonths(7);
var monthDayDiff = getMonthDays(d1, d2);
foreach (var kvp in monthDayDiff)
{
Console.WriteLine("Month: {0} Days: {1}", kvp.Key, kvp.Value);
}
« I am putting myself to the fullest possible use which is all, I think, that any conscious entity can ever hope to do » HAL (Heuristically programmed ALgorithmic computer) in "2001, A Space Odyssey"
|
|
|
|
|
PoolGameSingle poolgame = new PoolGameSingle();
var cue = poolgame.CueStick;
Body CueStickBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 15, 15,1);
CueStickBody.Position = new Vector2(902, 250);
cue = CueStickBody;
Geom CueStickGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, CueStickBody, 15, 15, 20);
CueStickGeom.CollisionGroup = 1;
CueStickGeom.RestitutionCoefficient = .8f;
CueStickGeom.FrictionCoefficient = 0
|
|
|
|
|
You have already posted the same question on StackOverFlow and GameDev, but why not also post the question on the FarSeer Discussion forum: [^].
« I am putting myself to the fullest possible use which is all, I think, that any conscious entity can ever hope to do » HAL (Heuristically programmed ALgorithmic computer) in "2001, A Space Odyssey"
|
|
|
|
|
If I wanted to post the question on that page, I would have done so long ago.. But nobody is replying me.
|
|
|
|
|
Member 10948508 wrote: If I wanted to post
Member 10948508 wrote: I would have done so
Member 10948508 wrote: But nobody is replying me.
Possibly, the latter is because of the first two?
You don't generally get replies to messages you haven't posted...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I know what you mean, OG; I get messages to replies I never made: those are the ones that really bother me !
« I am putting myself to the fullest possible use which is all, I think, that any conscious entity can ever hope to do » HAL (Heuristically programmed ALgorithmic computer) in "2001, A Space Odyssey"
|
|
|
|