pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
9+ messages / 3 participants
[nested] [flat]

* [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-15 04:42  "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
  0 siblings, 0 replies; 9+ messages in thread

From: commit4ever (@commit4ever) @ 2024-08-15 04:42 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi, 

Think pgvector isnt the issue nevertheless any leads would be useful. 

Setup that works:

##Ubuntu 14.9-1.pgdg20.04+1 ## on 8 cpu, 32g RAM VM.

"checkpoint_completion_target"	"0.9"	
"effective_cache_size"	"3145728"	"8kB"
"effective_io_concurrency"	"200"	
"huge_pages"	"try"	
"maintenance_work_mem"	"2097152"	"kB"
"max_connections"	"200"	
"max_parallel_workers"	"8"	
"max_parallel_workers_per_gather"	"4"	
"max_wal_size"	"8192"	"MB"
"max_worker_processes"	"8"	
"min_wal_size"	"2048"	"MB"
"random_page_cost"	"1.1"	
"shared_buffers"	"1048576"	"8kB"
"temp_buffers"	"1024"	"8kB"
"wal_buffers"	"2048"	"8kB"
"work_mem"	"10485"	"kB"

-------------------------------------
Setup that errors WITH ===> mmap(8812232704) with MAP_HUGETLB failed, huge pages disabled: Cannot allocate memory

##Ubuntu 14.13-1.pgdg22.04+1## on 24CPU , 220gb RAM + A100 80GB VM##

"checkpoint_completion_target"	"0.9"	
"effective_cache_size"	"10813440"	"8kB"
"effective_io_concurrency"	"200"	
"huge_pages"	"try"	
"maintenance_work_mem"	"2097152"	"kB"
"max_connections"	"200"	
"max_parallel_workers"	"12"	
"max_parallel_workers_per_gather"	"4"	
"max_wal_size"	"8192"	"MB"
"max_worker_processes"	"12"	
"min_wal_size"	"2048"	"MB"
"random_page_cost"	"1.1"	
"shared_buffers"	"3604480"	"8kB"
"temp_buffers"	"1024"	"8kB"
"wal_buffers"	"2048"	"8kB"
"work_mem"	"36044"	"kB"

----------------------------

Tried all manner of tweaks to pg config + also tried reducing the chunks size from 8096 (which works on the smaller setup) to 4096.  Nothing works and the DB shuts down when the only process is vector creations / insertions. 

Has anyone faced something similar ? 

@ankane @jkatz   any guidance would highly appreciated. 

Thanks.
Aiseei



^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-15 05:14  "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: commit4ever (@commit4ever) @ 2024-08-15 05:14 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@commit4ever renamed this.

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-15 14:14  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: jkatz (@jkatz) @ 2024-08-15 14:14 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

It's tough to provide guidance without knowing what query you're running where you see the OOM, if you're running this in a container or a standard process, what other processes are running on the system, and if there are any other memory constraints in place.

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-16 09:48  "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: commit4ever (@commit4ever) @ 2024-08-16 09:48 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @jkatz 

1) This is running in a container both Postgres and the backend in another container.
2) A few other containers but memory at peak does not exceed 10% of the 220G  of RAM.  
3) There we no LLM containers  running at the time. 
4) We re generating 768 dim vector  using all-mpnet-base-v2.
5) part of the trace is attached ===> 
 line 198, in raise_\n    raise exception\n  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_context\n    self.dialect.do_execute(\n  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 681, in do_execute\n    cursor.execute(statement, parameters)\nsqlalchemy.exc.OperationalError: (psycopg2.OperationalError) SSL SYSCALL error: EOF detected\n\n[SQL: CREATE INDEX  IF NOT EXISTS sentence_transformer_embedding_vector_idx_hnsw_l2_ops ON {schema}.app_embeddings USING hnsw ( sentence_transformer_embedding_vector vector_l2_ops) WITH (m = 16, ef_construction = 64);]\n(Background on this error at: http://sqlalche.me/e/14/e3q8)

Any advice would be great!

Thanks.



^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-17 21:59  "ankane (@ankane)" <noreply+ankane@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: ankane (@ankane) @ 2024-08-17 21:59 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-17 21:59  "ankane (@ankane)" <noreply+ankane@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: ankane (@ankane) @ 2024-08-17 21:59 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @aiseei, it seems like something is limiting the memory that's available for Postgres. I'd confirm you don't have any [memory constraints](https://docs.docker.com/engine/containers/resource_constraints/) set on the container (or anywhere else in the system).

Going to close this out since it doesn't seem like an issue with pgvector, but @jkatz may have additional ideas.

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-19 02:04  "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: commit4ever (@commit4ever) @ 2024-08-19 02:04 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

hi @ankane . no there are none. will loop back when we fix this. Thanks!

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-19 16:58  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: jkatz (@jkatz) @ 2024-08-19 16:58 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Borrowing a bit from another issue, it's very similar to what Andrew suggests. Because your HNSW index build is exceeding the available memory to build the index, which is likely governed by your container (cgroup) limits, the OOM killer is taking out the process, even If you have more resources on the machine. If the memory in your container exceeds the threshold cgroup threshold, the OOM killer kills the process putting on the most memory pressure (Joe Conway has an [excellent blog on this topic](https://www.crunchydata.com/blog/deep-postgresql-thoughts-the-linux-assassin)).

^ permalink  raw  [nested|flat] 9+ messages in thread

* Re: [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2"
@ 2024-08-30 01:26  "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
  7 siblings, 0 replies; 9+ messages in thread

From: commit4ever (@commit4ever) @ 2024-08-30 01:26 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Thanks. @jkatz @ankane .  The only way we 'resolved' this was upgrading to PG 15.8.1. Nothing was changed in terms of the memory settings  for PG or the container.

^ permalink  raw  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2024-08-30 01:26 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-15 04:42 [pgvector/pgvector] issue #643: OOM  errors - during insertion and HNSW l1 INDEX builds  on  version "0.7.2" "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
2024-08-15 05:14 ` "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
2024-08-15 14:14 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2024-08-16 09:48 ` "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
2024-08-17 21:59 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-08-17 21:59 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-08-19 02:04 ` "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>
2024-08-19 16:58 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2024-08-30 01:26 ` "commit4ever (@commit4ever)" <noreply+commit4ever@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox