You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Chia-Chun Shih <ch...@gmail.com> on 2014/10/01 09:49:33 UTC

persistent state for spark streaming

Hi,

My application is to digest user logs and deduct user quotas. I need to
maintain latest states of user quotas persistently, so that latest user
quotas will not be lost.

I have tried *updateStateByKey* to generate and a DStream for user quotas
and called *persist(StorageLevel.MEMORY_AND_DISK())*, but it didn't work.

Are there better approaches to persist states for spark streaming?

Thanks.

Re: persistent state for spark streaming

Posted by Yana Kadiyska <ya...@gmail.com>.
Yes -- persist is more akin to caching -- it's telling Spark to materialize
that RDD for fast reuse but it's not meant for the end user to query/use
across processes, etc.(at least that's my understanding).

On Thu, Oct 2, 2014 at 4:04 AM, Chia-Chun Shih <ch...@gmail.com>
wrote:

> Hi Yana,
>
> So, user quotas need another data store, which can guarantee persistence
> and afford frequent data updates/access. Is it correct?
>
> Thanks,
> Chia-Chun
>
> 2014-10-01 21:48 GMT+08:00 Yana Kadiyska <ya...@gmail.com>:
>
>> I don't think persist is meant for end-user usage. You might want to call
>> saveAsTextFiles, for example, if you're saving to the file system as
>> strings. You can also dump the DStream to a DB -- there are samples on this
>> list (you'd have to do a combo of foreachRDD and mapPartitions, likely)
>>
>> On Wed, Oct 1, 2014 at 3:49 AM, Chia-Chun Shih <ch...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> My application is to digest user logs and deduct user quotas. I need to
>>> maintain latest states of user quotas persistently, so that latest user
>>> quotas will not be lost.
>>>
>>> I have tried *updateStateByKey* to generate and a DStream for user
>>> quotas and called *persist(StorageLevel.MEMORY_AND_DISK())*, but it
>>> didn't work.
>>>
>>> Are there better approaches to persist states for spark streaming?
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>

Re: persistent state for spark streaming

Posted by Chia-Chun Shih <ch...@gmail.com>.
Hi Yana,

So, user quotas need another data store, which can guarantee persistence
and afford frequent data updates/access. Is it correct?

Thanks,
Chia-Chun

2014-10-01 21:48 GMT+08:00 Yana Kadiyska <ya...@gmail.com>:

> I don't think persist is meant for end-user usage. You might want to call
> saveAsTextFiles, for example, if you're saving to the file system as
> strings. You can also dump the DStream to a DB -- there are samples on this
> list (you'd have to do a combo of foreachRDD and mapPartitions, likely)
>
> On Wed, Oct 1, 2014 at 3:49 AM, Chia-Chun Shih <ch...@gmail.com>
> wrote:
>
>> Hi,
>>
>> My application is to digest user logs and deduct user quotas. I need to
>> maintain latest states of user quotas persistently, so that latest user
>> quotas will not be lost.
>>
>> I have tried *updateStateByKey* to generate and a DStream for user
>> quotas and called *persist(StorageLevel.MEMORY_AND_DISK())*, but it
>> didn't work.
>>
>> Are there better approaches to persist states for spark streaming?
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>
>

Re: persistent state for spark streaming

Posted by Yana Kadiyska <ya...@gmail.com>.
I don't think persist is meant for end-user usage. You might want to call
saveAsTextFiles, for example, if you're saving to the file system as
strings. You can also dump the DStream to a DB -- there are samples on this
list (you'd have to do a combo of foreachRDD and mapPartitions, likely)

On Wed, Oct 1, 2014 at 3:49 AM, Chia-Chun Shih <ch...@gmail.com>
wrote:

> Hi,
>
> My application is to digest user logs and deduct user quotas. I need to
> maintain latest states of user quotas persistently, so that latest user
> quotas will not be lost.
>
> I have tried *updateStateByKey* to generate and a DStream for user quotas
> and called *persist(StorageLevel.MEMORY_AND_DISK())*, but it didn't work.
>
> Are there better approaches to persist states for spark streaming?
>
> Thanks.
>
>
>
>
>
>
>