Hi Is there any way to limit the execution runs in a logic app from multiple instances to one at a time?
Take a look at concurrency control as seen in this excellent post: https://toonvanhoutte.wordpress.com/2017/08/29/logic-apps-concurrency-control/
This is the way to implement it, in code view:
"runtimeConfiguration": {
"concurrency" : {
"runs": 2
}
},
Related
This may be a question about coroutines in general, but in my ktor server (netty engine, default configuration) application I perform serveral asyncronous calls to a database and api endpoint and want to make sure I am using coroutines efficiently. My question are as follows:
Is there a tool or method to work out if my code is using coroutines effectively, or do I just need to use curl to spam my endpoint and measure the performance of moving processes to another context e.g. compute?
I don't want to start moving tasks/jobs to another context 'just in case' but should I treat the default coroutine context in my Route.route() similar to the Android main thread and perform the minimum amount of work on it?
Here is an rough example of the code that I'm using:
fun Route.route() {
get("/") {
call.respondText(getRemoteText())
}
}
suspend fun getRemoteText() : String? {
return suspendCoroutine { cont ->
val document = 3rdPartyLibrary.get()
if (success) {
cont.resume(data)
} else {
cont.resume(null)
}
}
}
You could use something like Apache Jmeter, but writing a script and spamming your server with curl seems also a good option to me
Coroutines are pretty efficient when it comes to context/thread switching, and with Dispatchers.Default and Dispatchers.IO you'll get a thread-pool. There are a couple of documentations around this, but I think you can definitely leverage these Dispatchers for heavy operations
There are few tools for testing endpoints. Jmeter is good, there are also command line tools like wrk, wrk2 and siege.
Of course context switching costs. The coroutine in routing is safe to run blocking operations unless you have the option shareWorkGroup set. However, usually it's good to use a separate thread pool because you can control it's size (max threads number) to not get you database down.
I've an angular app , I want to automatically from the application if the user put the browser idle for a long period of time . Say 15 minutes . For that ive written a service and its working fine . I'm catching user action using #HostListener . But I feel like , there might be a chance for a performance issue as the HostListener method is called upon each user action .
#HostListener('document:keyup', ['$event'])
keyUpListenere(event) {
this.idleTimeoutService.resetTimer();
}
#HostListener('document:click', ['$event'])
clickListener() {
this.idleTimeoutService.resetTimer();
}
#HostListener('document:wheel', ['$event'])
mouseWheelListener () {
this.idleTimeoutService.resetTimer();
}
Not at all, many applications use this kind of thing for automatic popup remiders of session timeouts. I would also include touchstart and/or touchend.
Yes, there are chance of performance, think that you are creating 3 listener that listen the actions on all your document.
You can assign this events on a main div of app.component on event functions, is better than make listeners.
I would like to start a service that once in awhile on all platforms has checked is there a notification to appear or not. Is there any nuget to connect all platforms or some examples?
You can use the Device.StartTimer(TimeSpan minutes) method to start a background task that will repeat after the given time span. Here is a code example:
var minutes = TimeSpan.FromMinutes (3);
Device.StartTimer (minutes, () => {
// call your method to check for notifications here
// Returning true means you want to repeat this timer
return true;
});
This is included with Xamarin Forms, so you don't need any platform specific logic.
http://iosapi.xamarin.com/index.aspx?link=M%3AXamarin.Forms.Device.StartTimer(System.TimeSpan%2CSystem.Func%7BSystem.Boolean%7D)
I think that the best that you can do is following:
Unfortunately, the way that these two platforms have evolved to handle executing background code is completely different. As such, there is no way that we can abstract the backgrounding feature into the Xamarin.Forms library. Instead, we going to continue to rely on the native APIs to execute our shared background task.
Further information for this topic can be found here:
https://robgibbens.com/backgrounding-with-xamarin-forms/
could someone help me to read NewRelic Summary and Trace details. Following screenshots have trace for a single transaction, which do not create any query to the database. It is just a simple query with few lines of Scala template code, which renders HTML page and returns it to the client. This is just a single transaction that is currently running in production. Production has plenty of more complex transaction running which do lots of external calls to Mongo, Maria, Queue, etc.
Does the trace reveal anything about where bottleneck could be? Are we for example running out of Threads or Workers. As I told most of the transactions do lots of web external calls, which might reserve single Thread for quite long time. How one can actually study if Threads or Workers are running out in Play application? We are using 2.1.4.
What actually happens in following calls?
Promise.apply 21.406ms
Async Wait 21.406ms
Actor.tell 48.366ms
PlayDefaultUpstreamHandler 6.292ms
Edit:
What is the purpose of following calls? Those have super high average call times.
scala.concurrent.impl.CallbackRunnable.run()
scala.concurrent.impl.Future$PromiseCompletingRunnable.run()
org.jboss.netty.handler.codec.http.HttpRequestDecoder.unfoldAndFireMessageReceived()
Edit:
play {
akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loglevel = WARNING
actor {
default-dispatcher = {
fork-join-executor {
parallelism-min = 350
parallelism-max = 350
}
}
exports = {
fork-join-executor {
parallelism-min = 10
parallelism-max = 10
}
}
}
}
}
I'm not sure if this will help you 1 year later but I think the performance problems you were hitting are not related to Play, Akka or Netty.
The problem will be in your code business logic or in the database access. The big times that you see for PromiseCompletingRunnable and unfoldAndFireMessageReceived are misleading. This times are reported by newrelic in a wrong and misleading way. Please read this post:
Extremely slow play framework 2.3 request handling code
I faced a similar problem, and mine was in the database but newrelic reported big times in netty.
I hope this helps you even now.
Is there something out-of-the-box to run a Linq query in background - maybe based on PLINQ? I have tried a few things, but did not find the proper approach.
I know I can create a background worker to do so, but I am looking for something "I can just use" not requiring to write the whole handling on my own.
Overall picture: I try to keep my WinForm application reactive wile reading the data (via LINQ) and avoid a "blocking" when reading larger amount of data.
You could spawn a Task<T>, and have it wrap your PLINQ query.
PLINQ isn't about creating asynchronous operations (what you want), but rather concurrent processing within a single (blocking) operation. Instead, you probably want to do something like:
Task<IEnumerable<YourType>> task = Task.Factory.StartNew(
() =>
{
// Use standard LINQ here...
return myCollection.Where(SomeCriteria);
}
);
// When this is completed, do something with the results
task.ContinueWith( t =>
{
IEnumerable<YourType> results = t.Result;
// Use results here (on UI thread - no invoke required)
}, TaskScheduler.FromCurrentSynchronizationContext());