cts | WebGPU Conformance Test Suite
kandi X-RAY | cts Summary
kandi X-RAY | cts Summary
WebGPU Conformance Test Suite
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cts
cts Key Features
cts Examples and Code Snippets
Community Discussions
Trending Discussions on cts
QUESTION
Apologies here in advance for this non-simplified use case.
During one of my data load processes, concurrent request transactions are used to fill MarkLogic.
Each concurrent thread does the following operations at a high level:
...ANSWER
Answered 2022-Apr-07 at 20:54When debugging, we do see concurrently when this transaction is being run, documents returned in the
cts:search
are locked for updates in other transactions. We are well aware of this possibility and are okay with it.
You may think that you are okay with it, but you are running into performance issues that are likely due to it, and are looking to avoid timeouts - so you probably aren't okay with it.
When you perform a search in an update transaction, all of the fragments will get a read-lock
. You can have multiple transactions all obtain read locks on the same URI without a problem. However, if one of those transactions then decides it wants to update one of those documents, it needs to promote it's shared read-lock
to an exclusive write-lock
. When that happens, all of those other transactions that had a read-lock
on that URI will get restarted. If they need access to that URI that has an exclusive write-lock
then they will have to wait until the transaction that has the write-lock
completes and lets go.
So, if you have a lot of competing transactions all performing searches with the same criteria and trying to snag the first item (or first set of items) from the search results, they can cause each other to keep restarting and/or waiting, which takes time. Adding more threads in an attempt to do more makes it even worse.
There are several strategies that you can use to avoid this lock contention.
Instead of cts:search()
to search and retrieve the documents, you could use cts:uris()
, and then before reading the doc with fn:doc()
(which would first obtain a read-lock
) before attempting to UPSERT (which would promote the read-lock
to a write-lock
), you could use xdmp:lock-for-update()
on the URI to obtain an exclusive write-lock
and then read the doc with fn:doc()
.
If you are trying to perform some sort of batch processing, using a tool such as CoRB to first query for the set of URIs to process (lock-free) in a read-only transaction, and then fire off lots of worker transactions to process each URI separately where it reads/locks the doc without any contention.
You could also separate the search and update work, using xdmp:invoke-function()
or xdmp:spawn-function()
so that the search is executed lock-free and the update work is isolated.
Some resources that describe locks and performance issues caused by lock contention:
- https://www.marklogic.com/blog/resolving-unresolvable-deadlocks/
- https://help.marklogic.com/Knowledgebase/Article/View/17/0/understanding-xdmp-deadlock
- https://help.marklogic.com/Knowledgebase/Article/View/understanding-locking-in-marklogic-using-examples
- https://help.marklogic.com/Knowledgebase/Article/View/strategies-to-ensure-if-locking-is-the-root-cause-for-performance-degradation-in-marklogic
QUESTION
I would like to to execute a cts:triple-range-query as illustrated in the example section on https://docs.marklogic.com/cts:triple-range-query. However, I put the triple in the document properties.
Unfortunately, the following query does not return the document.
...ANSWER
Answered 2022-Apr-10 at 19:24Try encapsulating your query in cts:properties-fragment-query like so:
QUESTION
Given these two approaches
...ANSWER
Answered 2022-Apr-10 at 01:12According to the source, nothing. They both assign to m_timer
QUESTION
I have a code which depends on a cancellation token with zero timeout to bail out early. This is the snippet
...ANSWER
Answered 2022-Mar-27 at 19:31To paraphrase the question:
Why, when you create a linked
CancellationTokenSource
from aCancellationTokenSource
with a registered timeout, then set the resultant token source with a timeout of zero, does it not know it should be cancelled?
More paraphrasing:
After all, zero is zero and it should know it's cancelled.
The answer is, because a CancellationTokenSource.CancelAfter
tries to register a timer callback, which attempts to set the resolution to zero milliseconds which it cannot possibly honor.
So in turn, you get the minimum resolution any standard timing mechanism can give you without using CPU spins, which is about 5+ milliseconds.
There are likely other solutions to your problem, however, in short you can't rely on a 0
second timeout to give you immediate confirmation via IsCancellationRequested
. You will need to rethink your problem.
QUESTION
I want to know how to cancel Tasks. already read some articles like this: https://docs.microsoft.com/en-us/dotnet/standard/threading/cancellation-in-managed-threads?redirectedfrom=MSDN
But i have already done Tasks and want to know how can i make them cancelable.
Either all at once and if that is not possible then one task should be canceled and then he should cancel the next one until all are gone.
EDIT Is that the correct using of CancellationToken? Tasks continue to run as I wanted, but when I press the cancel button I get an error. If I start my published version, the application just closes:* enter image description here
...ANSWER
Answered 2022-Mar-22 at 15:40Use a CancellationTokenSource, in a somewhat simplified example:
QUESTION
In my application I need to schedule executing of some Action
s with delay. It's like setTimeout
in JavaScript. Also, when app execution ends I need to cancel all scheduled executions that have not been executed yet. So I have to call Task.Delay
without await and pass CancellationToken
into it. But if I do so, I face with memory leak: none of CancellationTokenSource+CallbackNode
will be disposed until I call Cancel
and Dispose
of CancellationTokenSource
from which I take CancellationToken
s to pass to Task.Delay
.
Minimal reproducible example:
...ANSWER
Answered 2022-Mar-12 at 10:46I was a bit surprised, but it looks like this is on purpose. When a registration is cancelled, CancellationTokenSource
still keeps the instance of CancellationTokenSource+CallbackNode
in a free-list to reuse it for the next callback. This is an opiniated optimization, that can backfire in your scenario.
To illustrate this, try running your test twice in a row:
QUESTION
I have a build a service in MarkLogic and the service is consumed(GET Method) by a downstream application. In the REST endpoint, we have four parameters like startDate,endDate,seqStart and seqLength .
Total number of data which has to be send through the REST endpoint is 1.5M and we are sending it as batches of 25,000
I have noticed the Elapsed time is different for two executions which is having same batch size with different sequence start
...ANSWER
Answered 2022-Mar-08 at 16:21This is actually a common issue not only in MarkLogic but many other DBMS and search engine systems too.
You can locally run a query like this to verify it:
QUESTION
I'm writing a simplified asynchronous event driven Timer
class. Just wondering if this will work under all conditions and if it's thread safe. IE, any chance of it failing during invoke or reading the Enabled property or setting the AutoReset
feature.
ANSWER
Answered 2022-Feb-18 at 15:16As far as I can see, this is just a wrapper around Threading.Timer with a bunch of extra stuff around it that does not add any actual functionality. Your timer works by calling Task.Delay
, but this is just a wrapper around Threading.Timer
, so you might as well cut out the middleman.
Most the functionality you expose is already provided by this timer by calling the .Change
method. If you want to provide a more intuitive interface I would suggest wrapping this timer, or provide some extension methods, instead.
If you want the behavior that guarantees that the event is not raised concurrently, and that the execution-time is added to the period time, you should wrap the timer and set some due-time and an infinite period. Then at the end of your event handler you would call .Change
again to restart the timer.
If you write a simple wrapper around Threading.Timer
you will have a much easier time ensuring thread safety, since the Threading.Timer
is thread safe.
As it is, I think your class is probably kind of thread safe. But I'm fairly sure it can cause some behavior that is unexpected. For example, calling .Start()
multiple times would cause multiple loops to be started. I would have expected such a method to be idempotent.
QUESTION
I have upgraded API project from .NET 5 to .NET 6 successfully and running fine when executed locally (without Docker).
I have also updated the version in Dockerfile from "5.0-alpine3.13" to "6.0-alpine3.14" as below (only change I made).
...ANSWER
Answered 2022-Feb-09 at 08:05You've put the ENV statement in the 'build' part of the Dockerfile which means that it doesn't get placed in the final image. Either put it in the 'base' part or the 'final' part.
I'd put it in the 'base' section with the other ENV statements.
You might also want to move the apk add
to the base or final sections of the file, if you want the software installed in the final image.
QUESTION
If we try to save an XML from Marklogic with the help of xdmp:save
function, it saves the file in the UTF-8 format.
Now, if we try to save the same file with the help of the Marklogic CoRB tool, it saves that file into ANSI format instead of UTF-8.
Why?
Below XQuery code saving the XML file in UTF-8 format XML via Marklogic Qconsole.
...ANSWER
Answered 2022-Jan-31 at 21:49The CoRB tasks use the method method getValueAsBytes()
invokes:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cts
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page