Giter VIP home page Giter VIP logo

Comments (2)

kshshkim avatar kshshkim commented on July 17, 2024

WAS 메모리에 모든 위키 문서의 제목을 캐싱해두는 방법도 괜찮을 것 같음. 100만개의 문서가 존재한다고 해도 총 메모리 비용은 WAS 인스턴스 1개 당 500MB 아래일 것으로 생각됨. 버킷 확장, DB 쿼리시 메모리 피크를 감안해도 1기가 정도의 비용일 것임.

  • 추상화
    • 클래스 WikiPageTitleFilter (가제)
      • Stream<String> filterNonExistingTitles(Stream<String> titles);
  • 메모리에 위키 문서의 제목을 전부 캐싱
    • ConcurrentHashMap<String, Boolean> 등의 자료형을 활용하여 모든 제목을 캐싱
    • O(n) 연산이 일어나는 것은 어쩔 수 없지만, CPU 연산 비용이 부담이 될 경우, 인스턴스를 늘리는 것으로 쉽게 분산처리가 가능함.
    • 수천개의 제목이 존재한다고 해도, 네트워크 IO 비용에 비하면 아주 일부에 불과한 시간 안에 결과를 반환할수 있음.
    • 정합성
      • WAS 시작 시점에 DB에 쿼리를 넣어 캐시 데이터 초기화
        • ex) select wiki_page.title from wiki_page where wiki_page.is_active=true
        • 문서 숫자가 100만 건 정도로 많아진다면 한 번의 쿼리로 불러오는 것을 지양해야함. 주기적으로 csv 파일로 export 하는 방안을 생각해볼 수 있음.
      • 문서 생성 삭제 변경 이벤트를 기록해두고, 주기적으로 마지막 데이터 초기화 시점 이후의 이벤트를 캐시에 반영 (사가 패턴?)

from yetanotherwikiengine.

kshshkim avatar kshshkim commented on July 17, 2024

#11

from yetanotherwikiengine.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.