-
cache vs persistDE/spark 2022. 10. 31. 10:41
cache 나 persist 의 필요성 : action을 할때 두번 연산하지 않기 위해. action반복하면 필요
https://stackoverflow.com/questions/28981359/why-do-we-need-to-call-cache-or-persist-on-a-rdd
cache vs persist 차이 : 저장공간 설정의 차이인듯하다.
https://jhleeeme.github.io/spark-caching/
- pyspark에서
캐싱 여부 확인
저장공간 확인
print(df.is_cached) -- caching 확인 print(df.storageLevel) -- 저장공간 확인 df.cache() -- 정해진(preset) 저장공간 위치에만 가능 print(df.is_cached) -- caching 확인 print(df.storageLevel) -- 저장공간 확인 df.unpersist() -- cache 삭제 df.persist() -- custom 저장공간에 가능 print(df.is_cached) -- caching 확인 print(df.storageLevel) -- 저장공간 확인 df.unpersist()
reference : https://dbmstutorials.com/pyspark/spark-dataframe-caching.html
'DE > spark' 카테고리의 다른 글
StandardScaler (0) 2022.10.31 clustering (0) 2022.10.31 libSVM format (0) 2022.10.31 dataframe 보기 (0) 2022.10.27 SparkContext vs. SparkSession (0) 2022.08.17