-
Notifications
You must be signed in to change notification settings - Fork 17
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
RFE: Specify worker/executor memory under 'advanced cluster configuration' #66
Comments
Is this something that is typically done via a configmap on the worker nodes? If so, you can specify a worker configmap on the advanced form already. Is this RFE just to make that process easier (ie: specify the executor memory on the form, which in turn will create the configmap under the covers and use that)? |
It should be configurable via config-maps as |
Just thinking out loud here... on one hand it feels a bit heavy-weight to generate a config-map and apply it, for the purpose of setting a single property. On the other hand, we don't really want to get sucked into the business of adding dozens of fields in the UI, corresponding to a large and evolving list of spark properties. I wonder if it is possible to just add a text input where a person could add spark property settings:
Then have the logic of config-file creation run automatically. Easy button style, I guess. |
Maybe we can bake in some extra param on the oshinko-cli (which is what the webui uses under the covers) to specify configs like that. In turn, they can be used to either create a new configmap, or maybe even append to another configmap that is in use. |
Is there a possibility to define these criteria on the cli? |
I don't believe there is currently a specific flag in the cli to make this happen. I think that executor memory can be set in the spark configuration though and that functionality (overriding spark config defaults) is supported by both the cli and webui (the configmap would need to be created outside of the webui, either via the oc cli or the openshift console). |
Ok, here's a partial "how to" for at least part of this. (We'll be creating another issue to make this answer complete and more obvious in the near future). |
I'm sorry in advance if this sounds stupid but after generating a new configmap and using it with the cli like this:
After seeing that the pods span-up alright I peaked at the spark master webui and it said there that a total of only 4 cores are available instead of the 8 configured (4 cores * 2 workers). Am I doing something wrong? P.S. - if in your oppinion this should be under a seperate issue just say the word |
i think this has to do with how oshinko is provisioning the workers and the way that openshift assigns the cores to each container. from the spark docs:
i have a feeling that since we are not using kubernetes as the cluster scheduler that the workers in your case are doing what is described here. since we do not change the underlying container spawn resources, those containers will still have the default number of cores (and memory) defined by openshift policy. i'm not sure what the proper solution here is, but this sounds like more about the way spark interacts with openshift for creation of resources. this is a good gap to highlight though, thanks! |
@ThatBeardedDude Really happy to have you using oshinko, it's especially great to get feedback from someone who is looking with fresh eyes. Our cluster configmaps for the master and worker are organized around spark config files, so you can't actually drop config values directly in a configmap, they have to be contained in a file. The easiest way to do this in this case is to put your configs in a file and use --from-file
This will cause OpenShift to create a configmap where the filename is the key and the file contents are the value, and when it's mounted as a configmap volume the files will be written to /opt/spark/conf. Likewise, you can put multiple config files in a directory and do oc create configmap workerconfig --from-file=myconfigdir and each file will be added to the configmap Let us know if this works for you. |
I will! Thank you @tmckayus very much for this clarification! Maybe this should be added to the propper README as well :) |
@ThatBeardedDude noted :) We have a README about this but it needs to move, probably to the rad.io landing page in a HowTo. I'll add one |
@ThatBeardedDude as promised, this will show up on the landing page. Good? |
Amazing! |
This post is a problem I am facing while using Oshinko v0.4.6 - if this is solved at a current unreleased state, I'll be glad to see the solution Regarding the gap @elmiko and I discussed earlier, I set up a cluster (following step by step after the README @tmckayus put up) with this configmap:
Sadly, I was disappointed to see this in the openshift pod logs:
Meaning the oshinko create simply ignored my configmap. Any ideas? |
@ThatBeardedDude What do you see when you launch a job against your cluster? I just ran a cluster with 2g for executor memory and 2 cores for executors and when I launch a job against the cluster, I see the following (requesting start with both 2g memory and 2 cores): |
Can you share the job you ran so I could try and replicate your results? |
@ThatBeardedDude Here's what I did to get a quick test....
It's just using the already included spark-examples SparkPi job. |
@crobby I executed this command on one of my worker pods and the log output was this:
In short, for some reason my cluster did not accept the confmap I created and is still using the default. |
@ThatBeardedDude Can you share the contents of your configmap? oc get configmap -o yaml |
My output for
I created the the confmap ( file at
And this command : I set up the cluster with this command: I do have other confmap directories under |
@ThatBeardedDude Ok, I think there is an issue with the configmap itself. When I view the contents of my configmap, here is what I get... oc get configmap sparkconfig -o yaml
when I issue my create configmap command, my value for --from-file is a directory that contains spark-defaults.conf. I think your value c2m2 is actually a file itself and I suspect that is why you're not seeing the desired result. Can you create a directory with a file named spark-defaults.conf that contains your desired settings, then run the create configmap on that directory (yes, the --from-file naming can be misleading and took me a second to grasp as well--perhaps a little too flexible). I think that will get you where you want to be. |
My c2m2 is a directory.
Maybe it can't operate if |
Yes, I believe we key off of the name "spark-defaults.conf". This is necessary because other things (like logging via log4j.properties) can also be set in the same configmap. |
It's more than that, it's actually what Spark itself looks for. |
After changing to the spark-defaults.conf standard, I did some tests and discovered something interesting. I ran the sparkPi job on the default cluster (2 cores and 1g RAM per executor, 2 workers) and it worked perfectly - so surprise here. After that I created a c4m1 cluster (4 cores 1g RAM per executor, 1 worker) but it failed with: To ensure myself that this is indeed the problem I ran sparkPi again, now on a c1m1 cluster (1 core and 1g RAM per executor, 2 workers) and it worked! Finally a confmap of my making worked (joy). So two questions come to mind:
Any help with these questions? (At least the first one) |
It looks like there is the potential to set some environment variables that might be of use to us. |
Ok, a quick tweak and test (For my purposes, I modified our oshinko-webui to set these env vars at cluster-create time) seems to indicate that setting the env vars SPARK_WORKER_CORES and SPARK_WORKER_MEMORY does have an impact. On a cluster with my tweaks to set the env vars (2G for memory, and 1 for cores), in the Spark UI for the worker, I see the following.
I have not run many jobs against my updated cluster to see what the impact may be, but my simple sparkPi test did still run. Is the above result something you'd be interested in working with? If it is, I may be able publish my updated oshinko-webui image for you to use (along with instructions on how to use it). Ideally, you could share your results with us to determine if it's a feature we want to add to the whole oshinko suite (CLI and our our other web UI). |
This is exactly what I looked for! It would enable createing spark clusters designed for specific jobs. |
Note that I believe this can still be done with configmaps, because you can set that stuff in spark-env.sh if I'm not mistaken. |
Thanks @tmckayus you were correct, as usual. I verified your recommendation. For the sake of completeness, here is what my configmap looks like: oc get configmap sparkconfig -o yaml
|
Amazing! |
I was looking into this because of radanalyticsio/spark-operator#83 Please correct me if I am wrong or I am missing something. For instance I have no idea if this script is being somehow executed in our default ("non s2i") image. Problem with those memory settings is that for instance the Putting something into Another approach to this would be starting the JVM process with ...
resources:
requests:
memory: "2Gi"
cpu: "500m"
limits:
memory: "4Gi"
cpu: "1000m"
... There are couple of ways to have the K8s resource limits/cgroups as the way to set the memory:
pros: cons:
pros: not modifying any Spark specific files Or something in the middle between 1) and 2)... Like exec $SPARK_HOME/bin/spark-class$JAVA_AGENT $SPARK_JAVA_OPTS org.apache.spark.deploy.worker.Worker $SPARK_MASTER_ADDRESS and btw. It looks like something similar is already possible for spark-on-k8s scheduler: |
Executor memory defaults to 1 GB, which is a good default but it would be nice to have a convenient way to increase that when creating a cluster on the webui.
The text was updated successfully, but these errors were encountered: