10-04-2019 12:21 AM
Hai All .....
I am using a Queues for Data Recording and saving in to the file. But as per my requirement it is taking more time than expected. There is no problem with writing and reading from Queues but timing is the main problem in this. I wants know that can we use any another method to Read and write a data parallelly without using Queues ?
Thank you In Advance.....
10-04-2019 01:04 AM
Hi Praveen,
I am using a Queues for Data Recording and saving in to the file. But as per my requirement it is taking more time than expected.
What exactly is taking "more time than expected"? What is your expectation?
There is no problem with writing and reading from Queues but timing is the main problem in this.
Why do you want to replace queues when there is no problem with using queues?
I wants know that can we use any another method to Read and write a data parallelly without using Queues ?
Channels, notifiers, globals, locals…
But again: queues are most probably not the source of your problem! You should rather find the problem origin instead of removing queues from your code!
Btw. you forgot to show us your code (aka VI or snippet, but not just images) so we have no chance of advising improvements…
10-04-2019 03:23 AM
Just as Gerd says, Queues are most likely NOT your problem. They are as efficient as you can get if used right and allow to separate tasks into producer-consumer patterns that serve exactly the purpose to decouple the producer from the consumer so that the producer can keep churning away at full speed even if the consumer is sometimes temporarily held up by slow actions like having to create a new file to push the data into.
10-04-2019 03:46 AM
@Pathkula_Praveen wrote:
I wants know that can we use any another method to Read and write a data parallelly without using Queues ?
You can't. That's assuming you're talking about writing data to disk. If it's a performance issue i'll take a stab in the dark and guess you're opening and closing the file with every write?
/Y
10-04-2019 07:28 AM
@Pathkula_Praveen wrote:
I wants know that can we use any another method to Read and write a data parallelly without using Queues ?
Where is this data coming from? If a DAQmx task, then use the TDMS Configure Streaming VI to make DAQmx log the data straight to a TDMS file when you read it. If anything else, then queues are definitely your best bet and you have an issue in how you are logging the data.
10-04-2019 07:48 AM
If it's a performance issue i'll take a stab in the dark and guess you're opening and closing the file with every write?/Y
I agree. Another stab in the dark could be that you're trying to send data one point at a time at a high speed. Of course without seeing any code it's impossible to know the problem. As others have said the problem is most likely NOT with the queues as they will transmit data faster than the data can be written.
10-04-2019 07:51 AM
@Pathkula_Praveen wrote:
Hai All .....
I am using a Queues for Data Recording and saving in to the file. But as per my requirement it is taking more time than expected. There is no problem with writing and reading from Queues but timing is the main problem in this. I wants know that can we use any another method to Read and write a data parallelly without using Queues ?
Thank you In Advance.....
I was once told;
"Queues are almost always, almost full or almost empty."
Almost full means the consumers is not keeping up.
Almost empty indicates the producer is not filling the queue faster than the consumer can empty it.
Yamaeda already took a wild guess at why the consumer is not keeping up.
It is possible to optimize queues but before I waste a lot of words on that topic...
"Show us the code!"
Ben
10-04-2019 07:57 AM
@Ben wrote:.I was once told;
"Queues are almost always, almost full or almost empty."
Almost full means the consumers is not keeping up.
Almost empty indicates the producer is not filling the queue faster than the consumer can empty it.
I like this - so simple and so true.
10-04-2019 08:57 AM - edited 10-04-2019 08:58 AM
Show us what you've got thus far and we'll be able to advise solutions that should work.
Edit: Upload your VI, not a picture.
10-04-2019 10:44 AM - edited 10-04-2019 10:45 AM
As mentioned, your bottleneck is most likely writing the data to the file. Without seeing any code it is hard to say for sure. With this assumption, one way we have solved this type of issue in the past is to avoid processing the queue one element at a time. We create a simple state machine that is time based and when the timer expires, we flush the queue (flushing the queues returns an array of the queued elements) and process all of the elements at one time. When processing we create a single block of data that will be written to the file and only perform a single file write with that one block of data. This is much more efficient and works quite well.