w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
High Latency with NodeJS
I know this may sound strange but have you consider it is not an issue with node but with the OS setting. Have you checked your file handles and the number of connections the OS is showing to the socket? Have you also made sure the socket timeout in the OS is low enough? I have run into similar sounding performance issues with other code and it turned out to be the OS and not the code. Also check the package and see what it has for open allowed connections on the socket. I ave not looked at the node code but ran into a similar issue with the http client library in java. The application just backed up and it was just a configuration issue with number of connections.

Categories : Javascript

High latency with Tomcat first request
If you are using JSPs, they are compiled. If you are connecting to databases, the connection pool might be empty before. Generally speaking, if you have singletons which are initialized lazily, the first request has to wait. On top of this, the JIT plays its role: So after the first request, the JIT might have applied some optimizations. If it is a load test (or perfomance test), I would just ignore the first requests/runs, because this is still the "warm up" phase. Update You might find the information regarding a micro benchmark interesting.

Categories : Java

ActiveMQ Network of Brokers results in high message sending latency
What you are seeing is the effects of store-and-forward in a broker network. When you send a message from P, it is: stored in B1 and confirmed to P as sent. B1 then forwards it to B2 which stores it and confirms to B1; B1 deletes the message from its local store. B2 then forwards the message to C. When C consumes it, it acknowledges the message to B2, which B2 deletes from its local store. A message broker network is not transparent in the same way that regular networks are. The receiving and dispatching mechanisms on a broker are effectively seperated from each other by a message store, which is either on disk or in memory. Each broker is a stop on the way between the producer and a consumer. So in that respect I am not surprised to see a higher latency. I like the analogy that it'

Categories : Performance

How to detect High CPU and long response time issues with Asp.NET Web Api
A good option would be to take a mini-dump using something like Process Explorer and then inspect it with WinDBG or otherwise, to see what the threads are doing and so forth. I have a good blog post about how to do it here: http://www.haneycodes.net/but-it-didnt-happen-in-dev-or-qa/

Categories : C#

_wsplitpath_s() alternative to use with long paths
You could write a wrapper function that simply skips over the "long path" introducer, e.g.: errno_t _wsplitpath_long_s( const wchar_t * path, wchar_t * drive, size_t driveNumberOfElements, wchar_t *dir, size_t dirNumberOfElements, wchar_t * fname, size_t nameNumberOfElements, wchar_t * ext, size_t extNumberOfElements ) { if (_wcsnicmp(path, L"\\?\", 4) == 0) path += 4; return _wsplitpath_s(path, drive, driveNumberOfElements, dir, dirNumberOfElements, fname, nameNumberOfElements, ext, extNumberOfElements); }

Categories : C++

SQL Server 2008 R2 - Subquery to return range high
One of your problems here is that neither table, and especially the PHASE_KEYS_D table, have primary keys. It's almost always a good idea for all tables to have primary key, and preferably non-intelligent keys (meaning no data is represented in them, they're just dumb ids). This is how straight forward the query becomes when you have a primary key: alter table phase_keys_id add phase_id int not null identity (1,1) select p.phase_id,max(h.prhigh) from phase_keys_d p inner join stock_hist h on h.DSEQKEY between p.BEGKEY and p.ENDKEY group by p.phase_id And if you wanted to show the max with each detail row: ;with z as ( select h.dseqkey,p.phase_id,h.prhigh from phase_keys_d p inner join stock_hist h on h.DSEQKEY between p.BEGKEY and p.ENDKEY ) select z.dseqkey, z.

Categories : Sql Server

efficient alternative to if (a>b) in javascript for checking a variable range
Yes, use else clauses: var blah; if(a > 10){ blah = 'large'; }else if(a > 5){ blah = 'medium'; }else if(a >= 0){ blah = 'small'; } Since you are doing a simple assignment in each statement it could also be elegant to use a ternary expression, although many would argue that this is less readable: var blah = a > 10 ? 'large' : a > 5 ? 'medium' : a >= 0 ? 'small' : undefined; // May want to choose a better default value for a < 0

Categories : Javascript

Alternative HTML/CSS for Firefox not supporting input range
Use jQuery UI, more specifically Slider. It will save a lot of time.

Categories : Javascript

Would a long running sql command using connection pooling cause other command using that same connection to error?
The first statement is locking out all of the other statements at the database level. Are you using SQL Server? In my experience SQL Server locks tables in so many scenarios that the DBA always reverted to dirty reads--any other locking configuration caused too much contention. To get around this problem you can do the long running work in a temporary table, and then copy to the real table when the work is done.

Categories : Sql Server

vb excel keep 1 instance of duplicate items in a range
Put this in H1: =COUNTIF(G$1:G1;G1) Fill down to end Make an autofilter on column G Filter out values of 1 Select the remaining rows by row header Right click on row header > click Delete ...

Categories : Vb.Net

Extract duplicate records depending upon age range
Check this out: --create table sno (sno varchar(50), name varchar(100), rel_name varchar(100), age int) --insert into sno values --('1','AAKASH SOOD','RAJEEV SOOD','22'), --('2','AAKASH SOOD','RAJEEV SOOD','21'), --('3','AAMITA Kumari','RAJEEV VERMA','35'), --('4','AAMITA Kumari','RAJEEV VERMA','46'), --('5','AAKASH SOOD','RAJEEV SOOD','23'), --('6','NARESH VERMA','SHIV LAL SAHU','37'), --('7','NARESH VERMA','SHIV LAL SAHU','38') select distinct n1.* from sno n1 join sno n2 on n1.name = n2.name and n1.rel_name = n2.rel_name and n1.sno != n2.sno and (n1.age = n2.age or n1.age = n2.age + 1 or n1.age = n2.age - 1) SQLFiddle

Categories : Sql Server

How can I summarize a range of rows with duplicate values in them in Oracle?
If this can be done using a database view I think it would be very complex. One option you could look into would be to try to create an inner query which is the same table joined to itself on item_number = item_number+1 and add a column that detects where a.item_number != b.item number to determine group boundaries and then use this group boundaries column as the group by in the outer query. However, the problem is clearly better suited to a procedural approach looping through one row at a time. So I would recommend doing this as a pl/sql procedure instead if you can.

Categories : Oracle

Comparing two range of cells A and D and copy the duplicate data
if the Problem is only to put the right numbers into H, use this code for that. Put it just be for "end Sub". The code supposes you are never having more than 1000 rows filled in A and D, but you can change that. Range("H1").Select ActiveCell.FormulaR1C1 = _ "=SUMIF(R1C1:R1000C1,RC[-1],R1C2:R1000C2)+SUMIF(R1C4:R1000C4,RC[-1],R1C5:R1000C5)" Selection.Copy Range("H2:H" & WorksheetFunction.CountA(Columns(7))).Select ActiveSheet.Paste Application.CutCopyMode = False Range("H1:H" & WorksheetFunction.CountA(Columns(7))).Select 'the following lines are only necessary if you don't want a formula in H. Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False hope that helps! Max

Categories : Excel

pymysql lost connection after a long period
The wait_timeout exists for a reason: long-time idle connections are wasteful of limited server resources. You are correct: increasing it is not the right approach. Fortunately, this is Python which has a robust exception mechanism. I'm not familiar with pymysql but presumably you've got an "open_connection" method somewhere which allows try: cursor.do_something() except pymysql.err.OperationalError as e: if e[0] == 2013: # Lost connection to server # redo open_connection and do_something else: raise Since you didn't post any calling code, I can't structure this example to match your application. There things worth noting about the except clause: the first is that they should always be as narrow as possible, in this case there are (presumably) many Operati

Categories : Mysql

Perl Script for get values range and without duplicate from Symmetric Matrix file
Lengthy oneliner, perl -anE 'if(!@h){@h=@F;next} $l{$F[0]}{$h[$_]} = $F[$_] for 1..$#h }{shift@h; $_->[2]<0.3 or say "@$_" for map {$t=$_; map [$t,$_,$l{$t}{$_}], @h}@h' file or more explicit version # opening the file open my $fh, "<", "file" or die $!; my @header; my %matrix; while (my $line = <$fh>) { my ($label, @F) = split /s+/, $line; # split the line into fields if (!@header) { @header = @F; next; } # assign the fields through a hash slice @{ $matrix{$label} }{@header} = @F; } close $fh; my @arr = map { my $label = $_; map [ $label, $_, $matrix{$label}{$_} ], @header; } @header; for my $el (@arr) { print "@$el " if $el->[2] >= 0.3; }

Categories : Perl

App crashes in background while bluetooth connection lost for long time
i am assuming that you are on iOS 6.1 Are you handling device disconnect using the following delegate methods of CBCentralManager – centralManager:didDisconnectPeripheral:error: – centralManager:didFailToConnectPeripheral:error: also i suspect there is no device discovery when in background, so you might have to handle that logic in your code

Categories : Iphone

Azure Could Computing high availoability vs NEO4J high availability?
The short answer is probably yes. Windows Azure provide you infrastructure that allow you to build high availability system, it won't make any system high available by magic. As NEO4J is state-full, each node (with only one node Azure don't give you any SLA, you instance will be down) will need to share some state and the way to do it will be dependent on how NEO4J is working. So you will need to rely on NEO4J mechanism to do it. I don't know how NEO4J is working but you won't be able to skip designing an high available architecture around NEO4J using Windows Azure infra. Cloud may be a magic buzz word that can make things append on management level, but when we are on hard real world level Harry magic wand doesn't exist.

Categories : Neo4j

Eclipselink - what causes a long response time after the message “reconnecting to external connection pool”
I want to share the solution we found to the problem. Basically the problem was that we didn't have in our connection pool a definition to close connection if they are idle for X time then we would have picked up once in a while a connection that we thought was open but it was already closed by the OS So when we tried accessing the OS with a connection that was already closed - it took 15 minutes until we got a timeout bottom line - make sure you close idle connections

Categories : Mysql

quicksand sorting price values low to high / high to low
val() gives you a string, so > and < comparisons are lexographical (not numeric). Try wrapping the values in parseInt() or parseFloat(). Make sure to add appropriate error handling as well.

Categories : Jquery

Varnish High DB Connections In High Traffic
Mostly spiking backend connections has little to do with your varnish configuration but alot to do with the cachability of your site. Are there cookies that prevents you from caching efficiently? You can chose to strip them or remove all but chosen ones, there are examples for both on the varnish site. Do a varnishstat and check your hit rates during peaks. Is it a good cache hitratio? Is it the same as during low load? If it's the same or higher in low load it's easy to work on improving it at any time. Do a varnishtop -i txurl to see what requests are the most frequently sent to backend servers. Maybe it's some URLs that are just not cached due to faulty headers? Maybe some pages can be cached longer? Maybe some parts of the pages can be cached with ESI? Make sure your varnish is not

Categories : Mysql

When to use low < high or low + 1 < high for loop invariant
If your invariant is that the target must lie in low <= i <= high, then you use while (low < high); if your invariant is that the target must lie in low <= i < high then you use while (low + 1 < high). [Thanks to David Eisenstat for confirming this.]

Categories : Algorithm

C# CommandBuilder alternative or way to use CommandBuilder without a connection?
Is there a way to use CommandBuilder in a disconnected state? Unfortunately NO. SqlCommandBuilder is designed to work with a SqlDataAdapter and a SqlCommand object, or just a SqlCommand, and from the documenttation it needs to connect to the database to retrieve information shema.

Categories : C#

Audio Streaming Latency
Oddly enough the latency was appearing on the client side. After trying various combinations of settings I eventually decided to give DirectSoundOut ago instead of WaveOut. I was shocked to find that the latency shot way down. Guess I'll be using that in the future. dso= new DirectSoundOut(); //Direct Sound Removed nearly all latency //WaveOut waveOut = new WaveOut(); waveProvider = new BufferedWaveProvider(codec.RecordFormat); //WaveOut.Init(waveProvider); //WaveOut.Play(); dso.Init(waveProvider); dso.Play();

Categories : C#

Fragment and button latency
Never load something on the main thread if you can help it. Why are you loading a sound pool each instead of sharing it. Most likely the loading takes too long. You should load the sound pool on a background thread and only once.

Categories : Android

Monitor UI latency of web app from javascript
Well in simple terms, you measure the aggregate time of your UI functions, then divide by the number of calls :-) reliable UI timing: But, in all seriousness, this doesn't always work nicely. The reason is that certain operations are synchronous from the POV of JavaScript, but don't in fact update the DOM synchronously in practice. I've found that the best way to measure real-ish UI update time is to start measuring -- (new Date()).getTime() -- at the start of my UI update function, then at the end of it make a call to window.requestAnimationFrame(function(){ /* get elapsed time here! */ }); window.requestAnimationFrame is fairly new, so older browsers don't really support it. There's also some intrinsic time that elapses even if your update code does nothing, but you can measure th

Categories : Javascript

Linux Shell for Low Latency
As the comment on the question correctly points out, the question is not which Linux shell is best suited to high frequency trading, I think you mean kernel. It is my understanding there is not hard and fast answer to this, as there are many aspects to it such as hardware and type of systems which will be run to perform the high frequency trading. E.g. How are you managing data streams, message between threads, how is the business logic structured etc. This blog post series is very useful and will point you on the right direction: http://blog.kreyolys.com/2011/03/05/kernel-performance-tuning-is-art-not-science-part-1/

Categories : Linux

should I pass IntPtr by ref for better latency?
Structs are passed by value and there is no new heap object allocated for them. Also, IntPtr is a type natively understood by the CLR. It is the size of a single pointer. You should expect the same performance profile as you can expect from an int or long (depending on your bitness). Passing it by reference will slow things down because you wrap a pointer with a pointer.

Categories : C#

What do we mean by "top percentile" or TP based latency?
tp90 is a minimum time under which 90% of requests have been served. Imagine you have times: 10s 1000s 100s 2s Calculating TP is very simple: sort all times in ascending order: [2s, 10s, 100s, 1000s] find latest item in portion you need to calculate. For TP50 it will ceil(4*.5)=2 requests. You need 2nd request. For TP90 it will be ceil(4*.9)=4. You need 4th request. get time for the item found above. TP50=10s. TP90=1000s

Categories : Misc

MongoDB: How to measure latency or other parameters of DB
Take a look at the diagnostic commands in the reference: http://docs.mongodb.org/manual/reference/command/nav-diagnostic/ You can run any of those using DB.command(String) method. EDIT: I have also found a CommandResult DB.getStats() method in the Java API.

Categories : Java

Low latency on simple graph activation
If you have follow the manual, then the problem come from your data-model or use usage of it. If you already have down all possibles optimization for the usage, the last way is the more re-factoring of the data-model; If you don't have... just do it now. So the short answer : don't use inheritance, keep relation chains as short as possible. Longer answer : Dynamism cost a lot. Class inheritance add dynamism to the method resolution and object resolution at activation. In an hibernate/sql like db; An inheritance can be see as join on tables, loading an object imply loading multiple line in a mush table as inheritance level. So the speed is limited by the join requiere (and the join conditions). In db4o when you navigate throw an object the decision to use all fields of the objects is

Categories : Database

How to reposition graphics in windows with no latency?
If you're using D3D / DirectDraw. Double buffering is known to cause input lag, triple causes even more. And if you take VSYNC into account then the process would block for even as much as 20 ms. That means you will have a 20ms gap between the input events. Double/Tripple buffering aren't usually the problem 'cause VSYNC blocks for 2000% the time required to render the screen. Because normally it takes 1-2 ms to render the screen but 17-24 ms waiting for VSYNC. For example [c++]: - Take a look here .

Categories : C#

Low latency logging of timestamps that are usually nanoseconds apart
The best way of doing this is to log the time before the method call then call the method thousands or even millions of times and log the end time. A quick division will tell you to total time for a single call (which will be very small). Due to JIT'ing make sure you test the method in the same way it will run in production or you could end up with a different result in the real world to one in testing. Additionally you might like to run the method a few thousand times before starting the time test to try to ensure you are actually running the fully optimized code.

Categories : Java

Threaded low latency audio on Android
I think the fundamental problem lies in the performance of your synth-engine. A decent channel count with a Cortex-A8 or -A9 CPU is achievable with a single core. What language have you implemented it in? If it happens to be Java, I recommend porting it to C++. Using multiple threads for synthesis is certainly possible, but brings with it new problems - namely that each thread must synchronise before the generated audio can be mixed. Unless you take an additional latency hit that would come from running the synthesis threads asynchronously, the likely set-up is that in your render call-back you'd signal the additional synthesis threads and then wait for them to complete before mixing the audio from all of them together. (an obvious optimisation is that the render call-back runs

Categories : Android

Open MPI Broadcast Latency Measurement
An MPI_BCAST is usually implemented in some sort of tree fashion where processes at the top of the tree can exit the algorithm after they've finished their part of the broadcast. So if rank 0 sends messages to ranks 1 and n/2, then it can leave after those messages are done. So the answer to your question is: no, that's not an accurate measurement. Without accurately synchronized clocks, it's difficult to actually measure the time that a full broadcast takes across all nodes. There are tricks you can do to get closer (use an MPI_BARRIER to synchronize before taking the start time and use the longest time spent by any process in the broadcast), but as clocks still tend to have some drift, nothing will be perfect.

Categories : C++

Cassandra 1.2 huge read latency
The trace seems to show that much of the time is doing or waiting for network operations. Perhaps your network has problems? If only some operations fail, perhaps you have a problem with only one of your nodes. When that node is not needed, things work, but when it is needed things go badly. It might be worth looking at the log files on the other nodes.

Categories : Cassandra

Typical UDP latency on iPhone over 3G - are my numbers right?
I saw this link on iphone Wifi latency and I decided to try pumping UDP packets faster. I started lowering my delay between receiving a ping and sending a new ping until I reached 50 ms. At 50 ms, the UDP ping (roundtrip) was down to around 80 ms using 3G (remember, this was originally around 2000 ms)! TCP also improved, but not as much as UDP. I would get 100-200 ms, again on 3G. My conclusion is that iPhone powers down the antennae, which severely affects UDP. TCP is better, because the phone knows of the open connection and is faster to power up. Incidentally during packet loss, TCP would reach pings of 1000-2000 ms. This coincides with own observations that TCP connections would occasionally suffer large delays on the iPhone.

Categories : Iphone

CSS3 collapse works with latency
It looks that it happens because the collapsing animation starts to change the max-height from the very large value and it takes to it some time to cross the actual height of the element, and the visible change of the height starts only after that moment. The only workaround I see is to use separate animations for expansion and collapsing — a bit longer one with easing-in for the first and a bit shorter one that starts very sharply and eases out just before ending for the latter, like the following: .box { width: 300px; max-height: 30px; overflow: hidden; background: #aaa; transition: max-height 300ms cubic-bezier(0, .6, .6, 1); /* for collapsing */ } .box.open { max-height: 999px; transition: max-height 400ms ease-in; /* for expansion */ } fiddle

Categories : CSS

Get total Latency - UDP Audio Communication
You can work out roughly the input and output latency by knowing the buffer sizes of WaveIn and WaveOut. By default in NAudio they are each 100ms. For network latency, you could try timestamping your audio packets although the clocks of both machines would need to be in sync.

Categories : Networking

MMIO read/write latency
If the NIC card needs to go over the network, maybe through switches, to get the data from a remote host, 5.5us is a reasonable read time. If you are reading a register in the local PCIe device, it should be less than 1us. I don't have any experience with the Intel 10G NIC, but have worked with Infiniband and custom cards.

Categories : Linux

How to shorten the latency of openmax avc decoder?
I would not care relative latency but rather measure latency in time units and then try to identify where latency is generated. It might be that (I saw such implementation in some platform vendor code) there is some threshold on output buffer queue and FBD is not sent immediately. It also might be a characteristic of internal h264 decoding unit implementation. I do not have code of Tegra (note), but Exynos implementation is available by default from aosp. Assuming that you are able to build/upload *.so I would start from doing some measurements in I-frame decoding mode. In Exynos (as also in other cases) it is triggered by thumbnail mode but be aware that quite frequently integrators set google's decoder as default for thumbnail creation - in that case you must get rid of this or run thum

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.