Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

내가 직접 짜보는 신규 병렬처리 코드를 넣어본다. #3

Closed
wants to merge 1 commit into from

Conversation

sigridjineth
Copy link

시도

https://www.notion.so/24-7-4-USIO-1fb3c634391142c2baaede470f4285b4?pvs=4#2ecdd64c66464d68ac7bf09920bc39d4

concurrent.futures.ProcessPoolExecutor를 사용하여 여러 페이지를 동시에 처리합니다.

_process_pdfminer_pages_parallel과 _process_single_page 함수로 나누어 병렬 처리를 지원합니다.

각 페이지를 독립적으로 처리하고, 결과를 나중에 모아서 elements 리스트에 추가합니다.

모든 페이지 처리가 완료된 후 전체 요소를 한 번에 정렬합니다.

각 페이지 처리마다 새로운 PDFResourceManager와 PDFPageAggregator를 생성합니다.

아래 코드에서 제안한 내용을 바탕으로 작성해보았습니다.

https://blog.shikoan.com/pdfminer-parallel/#google_vignette

시도해보자.

  • request: 8 core 32Gi 주고 시작

on prem

  • 5분 40초 소요 → 이는 원래 시간과 비슷함.
  • 최대 코어 8개 사용함을 확인함

eks

  • 20분 걸림. → 이는 원래 시간과 비슷함.
Every 1.0s: kubectl top pods...  MacBook-Pro-44.localdomain: Thu Jul  4 16:50:51 2024

NAME                              CPU(cores)   MEMORY(bytes)
unstructuredio-6c5bcddd48-nhwkj   4662m        9040Mi
2024-07-04 07:46:18,872 unstructured INFO hello! you are in the modified method >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
(  사이에  1 정도 뭔가 딜레이가 있는  >>>>>>>>>>>>>>>>>>>>>>>> )
( 참고로 pdf pages spilt 자체는 <20 안으로 모두 처리됨 )
Ignoring (part of) ToUnicode map because the PDF data does not conform to the format. This could result in (cid) values in the output. The start object is not a byte.
Ignoring (part of) ToUnicode map because the PDF data does not conform to the format. This could result in (cid) values in the output. The start object is not a byte.

결론

병렬 시도로 수확이 없었다. 시간 차이가 없다.

@sigridjineth sigridjineth requested a review from go-noah July 4, 2024 13:07
@sigridjineth sigridjineth self-assigned this Jul 4, 2024
@sigridjineth sigridjineth changed the title 내가 직접 짜보는 신규 코드를 넣어본다. 내가 직접 짜보는 신규 병렬처리 코드를 넣어본다. Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant